home *** CD-ROM | disk | FTP | other *** search
/ Meeting Pearls 1 / Meeting Pearls Vol 1 (1994).iso / installed_progs / text / faqs / linux.howto.printing < prev    next >
Encoding:
Internet Message Format  |  1994-01-25  |  91.0 KB

  1. Subject: Linux Printing HOWTO
  2. Newsgroups: comp.os.linux.announce,comp.os.linux.admin,comp.answers,news.answers
  3. From: gtaylor@cs.tufts.edu (Grant Taylor)
  4. Date: 25 Jan 1994 04:24:44 GMT
  5.  
  6. Archive-name: linux/howto/printing
  7. Last-Modified: 1 Dec 93
  8.  
  9.                             The Linux Printing HOWTO 
  10.  
  11.                        by Grant Taylor and Brian McCauley 
  12.  
  13.  
  14.                                    Contents: 
  15.  
  16.                                     1 Intro 
  17.  
  18.                          2 Printing and Faxing Software 
  19.  
  20.                                      3 LPR 
  21.  
  22.                                   4 Previewing 
  23.  
  24.                               5 Ascii Translation 
  25.  
  26.  
  27.  
  28.  
  29.         0.1 Intro 
  30.  
  31.         This is the Printing  HOWTO for Linux. This  is a member of the 
  32.         second  generation  of  Linux  FAQS.  The  original  Linux  FAQ 
  33.         gradually   became  a  monolithic   beast,  and  has  now  been 
  34.         re-written in a new syle,  refering to HOWTOs for details. This 
  35.         HOWTO details  how to properly  set up most  types of printers, 
  36.         how to  configure the  software to  make them  print well, what 
  37.         types of  fax software are  available, and how  to preview many 
  38.         types  of  printable output.  Other  HOWTOs  detail networking, 
  39.         kernel hacking,  etc. All HOWTOs  are found  in several places, 
  40.         the                   official          location          being 
  41.         sunsite.unc.edu:/pub/Linux/docs/HOWTO,    and   another   being 
  42.         rtfm.mit.edu. 
  43.  
  44.           Please      send    comments,    bug    reports,    etc,   to 
  45.         printing@god.ext.tufts.edu.  This address  goes to  both Brian 
  46.         and Grant. 
  47.  
  48.           If  you know  anything  or can  point  us towards  any useful 
  49.         programs not  in this  document that  should be,  please let us 
  50.         know! 
  51.  
  52.           Grant has  a mail  server set  up on  his machine.  It stores 
  53.         documents and other  things related to  printing and previewing 
  54.         with Linux, including  the latest and  greatest version of this 
  55.         document.  Mail to  listserv@god.ext.tufts.edu  with a  body of 
  56.         ``info'' will have you  sent a list of  available files. A body 
  57.         of ``get  file1 [  file2 file3... ]  '' will  send you specific 
  58.         files. 
  59.  
  60.  
  61.         0.1.1 Summary of changes 
  62.  
  63.  
  64.         * Now in La [ me ] TeX! 
  65.  
  66.  
  67.         * New mailserver info. 
  68.  
  69.  
  70.         * Assorted little changes 
  71.  
  72.  
  73.         0.2 Printing Software 
  74.  
  75.         These sections describe printing software known to be available 
  76.         for Linux. Note that most  Un*x printing software can be easily 
  77.         compiled under Linux. 
  78.  
  79.  
  80.         0.2.1 text 
  81.  
  82.         Under  Linux,  or under  most  any Un*x  operating  system, the 
  83.         easiest thing to  print with most printers  is plain ASCII. Any 
  84.         way  you  can  arrange  to send  the  text  to  the  printer is 
  85.         perfectly valid. If you have a serial printer, then try devices 
  86.         /dev/ttys?, /dev/ttyS?,  /dev/cua?, etc,  and if  you have a 
  87.         regular  parallel  hookup, use  /dev/lp?.  Typing  ``cat file 
  88.         >/dev/????'' should  do it. You  may need  root privileges, or 
  89.         you may wish  to chmod your  printer device if  this is all you 
  90.         ever print. (Note  the security hole there  if you've more than 
  91.         one user) Some printers (ie,  HP DeskJet) want dos-style end of 
  92.         lines: newline+carriage  return. These  printers will  show the 
  93.         'staircase effect'; further information on  how to deal with it 
  94.         is in ``How do I prevent the staircase effect,'' 
  95.  
  96.  
  97.         0.2.2 pr 
  98.  
  99.         Most plain ascii files in the  un*x world have a tendency to be 
  100.         just that  - plain,  unformatted ascii  with no  page breaks or 
  101.         anything else  to make  a printed copy  look nice  and not have 
  102.         lines printed over perferations. The  answer to this problem is 
  103.         to  run your  text  through a  formatter such  as  pr. Pr  is a 
  104.         standard  un*x  utility  designed  to  format  plain  text  for 
  105.         printing  on  a  line  printer.  The  usual  appearance  of the 
  106.         resulting  formatted  text  has a  header  and/or  footer, page 
  107.         numbers, the date, possibly margins, double spacing, etc. As is 
  108.         common with  un*x utils, pr  has a bazillion  options. They are 
  109.         detailed in the man page. 
  110.  
  111.  
  112.         0.2.3 Postscript 
  113.  
  114.         Printing  almost  anything  other than  plain  text  under Un*x 
  115.         usually involves the ability to print Postscript. If you have a 
  116.         Postscript printer, you're  all set. But for  most, this is not 
  117.         so easy. 
  118.  
  119.           The established way to interpret Postscript under Linux is to 
  120.         use ghostscript, which, like nearly everything else, comes from 
  121.         the GNU project. Ghostscript  is a Postscript interpreter which 
  122.         accepts Postscript input and generates output appropriate for X 
  123.         displays, most printers, some specialized display hardware, and 
  124.         fax software. 
  125.  
  126.           The   following  devices  are  available  as  of  ghostscript 
  127.         2.6.1pl4: 
  128.  
  129.  
  130.           
  131.                   linux   PC vga using linux vgalib
  132.           #       x11     X Windows version 11, release >=4   [Unix and VMS only]
  133.           # Printers:
  134.           # *     appledmp  Apple Dot Matrix Printer (Imagewriter)
  135.           #       bj10e   Canon BubbleJet BJ10e
  136.           # *     bj200   Canon BubbleJet BJ200
  137.           # *     cdeskjet  H-P DeskJet 500C with 1 bit/pixel color
  138.           # *     cdjcolor  H-P DeskJet 500C with 24 bit/pixel color and
  139.           #               high-quality color (Floyd-Steinberg) dithering
  140.           # *     cdjmono  H-P DeskJet 500C printing black only
  141.           # *     cdj500  H-P DeskJet 500C (same as cdjcolor)
  142.           # *     cdj550  H-P DeskJet 550C
  143.           # *     declj250  alternate DEC LJ250 driver
  144.           # +     deskjet  H-P DeskJet and DeskJet Plus
  145.           # *     dfaxhigh  DigiBoard, Inc.'s DigiFAX software format
  146.           # *     dfaxlow  DigiFAX low (normal) resolution
  147.           #       djet500  H-P DeskJet 500
  148.           # *     djet500c  H-P DeskJet 500C
  149.           #       epson   Epson-compatible dot matrix printers (9- or 24-pin)
  150.           # +     eps9high  Epson-compatible 9-pin, interleaved lines
  151.           #               (triple resolution)
  152.           # *     epsonc  Epson LQ-2550 and Fujitsu 3400/2400/1200 color printers
  153.           # *     escp2   Epson ESC/P 2 language printers, including Stylus 800
  154.           # +     ibmpro  IBM 9-pin Proprinter
  155.           # *     jetp3852  IBM Jetprinter ink-jet color printer (Model #3852)
  156.           # +     laserjet  H-P LaserJet
  157.           # *     la50    DEC LA50 printer
  158.           # *     la75    DEC LA75 printer
  159.           # *     lbp8    Canon LBP-8II laser printer
  160.           # *     ln03    DEC LN03 printer
  161.           # *     lj250   DEC LJ250 Companion color printer
  162.           # +     ljet2p  H-P LaserJet IId/IIp/III* with TIFF compression
  163.           # +     ljet3   H-P LaserJet III* with Delta Row compression
  164.           # +     ljet4   H-P LaserJet 4 (defaults to 600 dpi)
  165.           # +     ljetplus  H-P LaserJet Plus
  166.           # *     m8510   C.Itoh M8510 printer
  167.           # *     necp6   NEC P6/P6+/P60 printers at 360 x 360 DPI resolution
  168.           # *     nwp533  Sony Microsystems NWP533 laser printer   [Sony only]
  169.           # *     oki182  Okidata MicroLine 182
  170.           #       paintjet  H-P PaintJet color printer
  171.           # *     pj      alternate PaintJet XL driver 
  172.           # *     pjxl    H-P PaintJet XL color printer
  173.           # *     pjxl300  H-P PaintJet XL300 color printer
  174.           # *     r4081   Ricoh 4081 laser printer
  175.           # *     sparc   SPARCprinter
  176.           # *     t4693d2  Tektronix 4693d color printer, 2 bits per R/G/B component
  177.           # *     t4693d4  Tektronix 4693d color printer, 4 bits per R/G/B component
  178.           # *     t4693d8  Tektronix 4693d color printer, 8 bits per R/G/B component
  179.           # *     tek4696  Tektronix 4695/4696 inkjet plotter
  180.           #%*     trufax  TruFax facsimile driver  [Unix only]
  181.           # File formats and others:
  182.           #       bit     A plain "bit bucket" device
  183.           #       bmpmono Monochrome MS Windows .BMP file format
  184.           #       bmp16   4-bit (EGA/VGA) .BMP file format
  185.           #       bmp256  8-bit (256-color) .BMP file format
  186.           #       bmp16m  24-bit .BMP file format
  187.           #       gifmono Monochrome GIF file format
  188.           #       gif8    8-bit color GIF file format
  189.           #       pcxmono Monochrome PCX file format
  190.           #       pcxgray 8-bit gray scale PCX file format
  191.           #       pcx16   Older color PCX file format (EGA/VGA, 16-color)
  192.           #       pcx256  Newer color PCX file format (256-color)
  193.           #       pbm     Portable Bitmap (plain format)
  194.           #       pbmraw  Portable Bitmap (raw format)
  195.           #       pgm     Portable Graymap (plain format)
  196.           #       pgmraw  Portable Graymap (raw format)
  197.           #       ppm     Portable Pixmap (plain format)
  198.           #       ppmraw  Portable Pixmap (raw format)
  199.           # *     tiffg3  TIFF/F (G3 fax)
  200.           
  201.           
  202.         Lines beginning  with a  ` #  ' are  drivers included  with the 
  203.         gs261 source distribution. 
  204.  
  205.           Drivers marked with % require commercial software to work 
  206.  
  207.           Installations  of  ghostscript  are  available  from  several 
  208.         places: 
  209.  
  210.           A full, and presumably  correct, installation is available in 
  211.         the  SLS; note  that this  binary  requires libX.so.???,  as it 
  212.         includes the X11 display driver. 
  213.  
  214.           The  `official' installation  is  to obtain  the  sources and 
  215.         build it yourself: 
  216.  
  217.         
  218.         prep.ai.mit.edu:/pub/gnu/ghostscript-xxxx.tar.gz
  219.         and                      ghostscript-fonts-xxxx.tar.gz
  220.         
  221.  
  222.           This  is probably  best, as  you can  get the  latest version 
  223.         (currently 2.6.1pl4  (the four  patches are  separate, they are 
  224.         available from my mail-server as gs261-patches)). 
  225.  
  226.           A  patch which  uses the  Linux svgalib,  and hence  does not 
  227.         require       X    for    previewing    is    available    from 
  228.         ws105.zfn.uni-bremen.de:/pub/gs261-linuxdriver.sh. 
  229.  
  230.           A  minimal  binary installation  of  ghostscript  and several 
  231.         other packages needed  for printing the  Linux documentation is 
  232.         available                                                    as 
  233.         sunsite.unc.edu:/pub/linux/apps/tex/texmin/texmin-0.1.tar.z. 
  234.         Note that this  does not contain any  postscript fonts. (Nor do 
  235.         you need them to print dvi (aka [ La ] TeX).) 
  236.  
  237.           The main Ghostscript  documentation is contained  in the file 
  238.         use.doc,      either    in    the    source    directory,    or 
  239.         .../lib/ghostscript/doc/use.doc if you haven't the sources. 
  240.  
  241.           To print ps, first determine your driver name with: 
  242.  
  243.         gs -help 
  244.  
  245.         which lists  installed drivers. If  the device you  need is not 
  246.         listed,   you  must   compile  gs  yourself   from  the  source 
  247.         distribution  (do  not  panic. do  follow  the  instructions in 
  248.         make.doc. you will need  5 or 6 megs of  space to build it in.) 
  249.         Then type 
  250.  
  251.         gs -dNOPAUSE -sDEVICE=?????? -sOutputFile=/dev/???? file.ps 
  252.  
  253.         and  your output  should  (hopefully) appear  at  your printer. 
  254.         Those  of you  with non-US  paper  sizes may  wish to  build gs 
  255.         yourself   with  the   right  default,  or   you  may  use  the 
  256.         -sPAPERSIZE=a4 option. 
  257.  
  258.           Ghostscript may be  used to print at  most of the resolutions 
  259.         your printer supports; -r300,  -r150, -r360x180 are examples of 
  260.         the  option  used  to  control  this.  Dot  matrix  printers in 
  261.         particular need to choose an appropriate resolution, since they 
  262.         do not typically run at the most common 300. Note that versions 
  263.         2.6 and greater of ghostscript have more drivers. 
  264.  
  265.  
  266.         0.2.4 fonts 
  267.  
  268.         (This  section contains  font information  not specific  to any 
  269.         ghostscript  driver (nor  even  specific to  ghostscript). Font 
  270.         information  pertaining  to the  X11  gs drivers  (and  thus to 
  271.         ghostview)   is   included  in  the   ghostview  section  under 
  272.         previewing) 
  273.  
  274.           All versions of ghostscript  come with assorted public-domain 
  275.         fonts,  most  of which  were  generated from  bitmaps,  and are 
  276.         therefore of relatively poor  quality. However, ghostscript can 
  277.         use any PostScript  Type 1 or  3 fonts you  may have handy. For 
  278.         example, the  Adobe Type Manager  (for any  platform other than 
  279.         mac (a conversion util for mac ps fonts was on simtel-20 in the 
  280.         windows3 directory))  comes with fonts  you can  use. Place the 
  281.         fonts (typically  *.pc?) in  .../lib/ghostscript/fonts/ and add 
  282.         to your fontmap lines such as: 
  283.  
  284.         /Courier (com_____.pfb) ; 
  285.  
  286.         A full fontmap file  for the ususal set  of fonts included with 
  287.         the Adobe  Type Manager  is available  as fontmap.atm  from the 
  288.         printing mailserver. 
  289.  
  290.           TimesNewRomanPS  and  ArialMT fonts  are  interchangable with 
  291.         Times Roman and  Helvetica, so you  can alias them  this way if 
  292.         this is what you have. 
  293.  
  294.           Adobe Type 1 fonts may be found on the net in several places: 
  295.         ftp.cica.indiana.edu:/pub/pc/win3/fonts                     and 
  296.         archive.umich.edu:/msdos/mswindows/fonts 
  297.  
  298.           I have  not looked in  these places, but  this information is 
  299.         lifted straight from the comp.fonts  FAQ (which you should read 
  300.         if fonts are a thing for you. I'll be glad to mail you a copy). 
  301.  
  302.           Conversion between various font  types is tricky. Ghostscript 
  303.         comes with the tools needed  to take a bitmap (hopefully large) 
  304.         and make  a scalable  ps font.  Groff comes  with the  tools to 
  305.         allow  use of  tfm/mf (TeX)  and  pfb (Type  1) fonts  in *roff 
  306.         documents.  X11R5 includes  several font  utilities and  Type 1 
  307.         rendering  code contributed  by IBM.  I have  used none  of the 
  308.         above, but  they all  come with  manpages, so  read them. Other 
  309.         font  conversion utilities  are listed  in the  comp.fonts FAQ. 
  310.         Also        look    into     the    package     fontutils    on 
  311.         prep.ai.mit.edu:/pub/gnu 
  312.  
  313.  
  314.         0.2.5 faxing 
  315.  
  316.         If you have a fax modem, you  can arrage to fax things out (and 
  317.         in),  including PostScript,  dvi,  ascii, etc...  Arranging for 
  318.         e-mail to fax itself somewhere is also straightforward. 
  319.  
  320.           Fax modems correspond to  one of two types:  Classes 1 and 2. 
  321.         Class one modems are  fairly common and have  less of what goes 
  322.         on in a fax supported in  firmware (thus the software has to do 
  323.         more  and  do  it  carefully.  supporting  such timing-critical 
  324.         things  under  a preemptive  multitasking  environment  such as 
  325.         Linux is  tricky at  best). The  class 1  standard is  EIA 578. 
  326.         Class 2 modems  tend to be  more expensive and  comply with the 
  327.         standard EIA 592. Mention of  your fax modem's level of support 
  328.         should be in its  manuals. Do not confuse  class and group. You 
  329.         would be hard pressed  to find a non-group  III fax modem these 
  330.         days (but you probably could). 
  331.  
  332.           Fax software  which runs  under linux  must convert  input in 
  333.         whatever format  into a Group  III compatible  image format for 
  334.         transmission. As  usual, Ghostscript  does the  job. The device 
  335.         tiffg3  generates standard  g3/tiff  encoded fax  messages. You 
  336.         must compile them in if they are not there already; this is yet 
  337.         another   reason  to  get  the  source.  Some  fax  sofware  on 
  338.         commercial platforms can use the display PostScript renderer to 
  339.         render the fax image; this is not yet an option under Linux. 
  340.  
  341.           The GNU program  netfax supports Class 2  fax modems only. It 
  342.         builds nearly out  of the box  under linux. I  have patches for 
  343.         version 3.2.1; you  can get them from  the printing mail server 
  344.         as ``netfaxpatch''.  It runs a  server and accepts  jobs into a 
  345.         queue from the local  machine and the net.  netfax is in use at 
  346.         MIT.  It  accepts  postscript,  dvi,  and  ascii,  and  can  be 
  347.         configured  to  work as  an  email gate.  Documentation  in the 
  348.         package  is limited  to  compile notes  and  man pages  for the 
  349.         individual programs; actual  installation tips are  few and far 
  350.         between. prep.ai.mit.edu:/pub/gnu/fax-3.2.1.tar.gz 
  351.  
  352.           FlexFax,                          available              from 
  353.         sgi.com(192.48.153.1):/sgi/fax/?????.src.tar.Z,  is  written in 
  354.         C++, and thus  requires g++ to build.  FlexFax supports class 1 
  355.         and 2 modems,  uses ghostview (or  a display postscript server) 
  356.         for  rendering, and  generally is  more  complete, or  at least 
  357.         general than the somewhat MIT-specific  netfax. It also can run 
  358.         in place of getty and either receive  a fax or spawn a login as 
  359.         appropriate   for  the  type   of  call.  It  includes  precise 
  360.         instructions on configuring  smail3 (and other  mail agents) to 
  361.         send mail  for so-and-so@12345678.fax  to the  fax at 12345678. 
  362.         This is the package I recommend  if you have real faxing needs, 
  363.         as it is properly documented  and full-featured. Version 2.x of 
  364.         FlexFax is in real release now  and fully supports Linux - just 
  365.         type ./configure and make. 
  366.  
  367.           mgetty+sendfax   is  a  Linux   and  SCO-specific  getty  for 
  368.         faxmodems  and a  simple sendfax  program.  This package  is on 
  369.         sunsite. This is  a good package  for those who  need to send a 
  370.         fax every now and then. 
  371.  
  372.           modgetty  (which  uses  tcl,  an  interpreted  language)  can 
  373.         receive faxes. Try harbor.ecu.purdue.edu:/pub/tcl 
  374.  
  375.  
  376.         0.2.6 *roff, man pages 
  377.  
  378.         Man pages can sometimes be  printed straight from the cat pages 
  379.         which come  with the  SLS (in lieu  of the  normal nroff source 
  380.         pages)  as though  they  were a  normal  text file  (which they 
  381.         mostly are). However,  many printers do not  like the VT escape 
  382.         codes  for  highlighting  and  what  not  that  find themselves 
  383.         imbedded in  these. A  filter for  this purpose  comes with the 
  384.         net-2 lpd package. It is called lpf. 
  385.  
  386.           If you  have the  nroff source  to the  page (the  finding of 
  387.         which I highly recommend) you can say 
  388.  
  389.         man -t foobar |lpr 
  390.  
  391.         and your man program will (hopefully) format the man page using 
  392.         groff into PostScript, which will then  be sent to your lpd and 
  393.         on to  the printer.  This form  of man  page output  looks MUCH 
  394.         better  than  the  plain  ASCII  version.  Unfortunately,  this 
  395.         depends  very much  on which  man  program and  what supporting 
  396.         software you have  installed. If your man  doesn't do this, you 
  397.         might    try  the   perl   version  of   man,   available  near 
  398.         sunsite.unc.edu:/pub/Linux/system/Manual-Pagers/ It  is written 
  399.         entirely in perl,  and is thus  easily customizable (perl being 
  400.         an interpreted language reminiscent of C and sh). 
  401.  
  402.           You   can  also  find  the  nroff  source  file  in  the  man 
  403.         directories (most versions  of man have an  option to just spit 
  404.         out the filename) and do it yourself, into any format supported 
  405.         by groff: 
  406.  
  407.         groff -mandoc -T ascii,dvi,ps,X100,X75,latin8 foobar.1 [ |lpr ] 
  408.  
  409.  
  410.         0.2.7 mpage 
  411.  
  412.  
  413.         The package  mpage converts  plain text  into postscript and/or 
  414.         prints  more  than one  page  onto  each peice  of  paper given 
  415.         postscript        or     text.    It     is     available    as 
  416.         wuarchive.wustl.edu:/pub/mirrors/unix-c/postscript/mpage.tar-z 
  417.         or thereabouts. Note that wuarchive  uses the -z suffix to mean 
  418.         .Z,  ie, compress,  not  GNUzip or  freeze.  ``man -t  foobar | 
  419.         mpage'' will send a 2-up (depending on the environment variable 
  420.         MPAGE)  version  of the  man  page  to lpr  and  its postscript 
  421.         interpreter. This saves paper and speeds up printing. 
  422.  
  423.  
  424.         0.2.8 a2ps 
  425.  
  426.         A2ps  will  take  ASCII  and turn  it  into  a  nice postscript 
  427.         document with headers and footers and page numbers, printed two 
  428.         pages on one  (or otherwise, if  you say so).  A2ps does a very 
  429.         nice job at this. It is available at the same place mpage is. 
  430.  
  431.  
  432.         0.2.9 enscript 
  433.  
  434.         Enscript is  a program which  does basically the  same thing as 
  435.         a2ps.  I  do not  know  where to  get  it. It  comes  with most 
  436.         commercial Un * xes. 
  437.  
  438.           A clone version of enscript is called nenscript, available as 
  439.         /pub/Linux/system/Printing/nenscript-1.13++.bin.tar.z        or 
  440.         /pub/Linux/system/Printing/nenscript-1.13++.tar.z on sunsite. 
  441.  
  442.  
  443.         0.2.10 gslp 
  444.  
  445.  
  446.         Gslp is one of the  uilities which comes with ghostscript 2.6.x 
  447.         and purports to do the same ascii --> ps conversion as enscript 
  448.         and a2ps. I have not used it, but the docs say that 
  449.  
  450.         gs -q -sDEVICE=????? -dNOPAUSE -- gslp.ps text.file [ options ] 
  451.  
  452.         should do the  trick. (gslp.ps is the  actual program, which is 
  453.         written  in  postscript.  Here  it  is  run  with  the argument 
  454.         `text.file.'  Postscript  is  in  many  respects  a programming 
  455.         language more  than a  mere printer  command language.) Further 
  456.         documentation is  in the file  gslp.ps. There is  a script file 
  457.         which does the above for you. 
  458.  
  459.  
  460.         0.2.11 psutils 
  461.  
  462.         Those of you who deal with large amounts of postscript may wish 
  463.         for more  utility programs  than come  with the  SLS. There are 
  464.         probably millions  of little programs  which do  things to your 
  465.         Postscript. A  representative package of  them may  be found in 
  466.         achilles.doc.ic.ac.uk:/tex/inter/psutils/                    or 
  467.         guardian.cs.psu.edu:/pub/src/psutil.tar.Z 
  468.  
  469.           These handle  page selection,  double-sided printing, booklet 
  470.         creation, etc.  Most large ftp  sites (eg, wuarchive.wustl.edu, 
  471.         ftp.uu.uunet) will have many such packages to choose from. 
  472.  
  473.  
  474.         0.2.12 tex/dvi 
  475.  
  476.         [ La ] TeX  is the text formatting package  used by many in the 
  477.         academic world  and elsewhere.  TeX works  much like  any other 
  478.         compiler -- source  code is run through  the program ``tex'' to 
  479.         become a .dvi file (analogous to  an .o object file in C) which 
  480.         can  be further  manipulated  to produce  printed  output. This 
  481.         manipulation of a dvi (DeVice Independant) file usually takes a 
  482.         little bit of  doing. It is  well worth it;  TeX's output is of 
  483.         professional quality. 
  484.  
  485.           For  those  in  the  real  world  who  cannot  afford  a  dvi 
  486.         understanding printer,  it is usually  best to  convert the dvi 
  487.         into postscript that you can  pipe into ghostscript or lpr. The 
  488.         SLS  comes  with a  functioning  installation of  both  TeX and 
  489.         dvips. Typing  ``dvips -f1 file.dvi  | lpr'' will  do it. Dvips 
  490.         responds   to   either  command   line  arguments   or  a  file 
  491.         /usr/TeX/lib/tex/ps/config.ps (in the  SLS TeX distribution, at 
  492.         least) in  which you  can arrange  to have  dvips automatically 
  493.         send  its  output  to  lpr.  Thus  ``dvips  file.dvi''  will do 
  494.         everything that needs to be done. 
  495.  
  496.           Note that some .dvi's may  include PostScript graphics in the 
  497.         dvips stage rather than the tex  stage of the game; if they are 
  498.         not  found, you  will get  a  hole instead  of a  picture. This 
  499.         follows naturally from the  object file analogy above. Usually, 
  500.         pre-made documentation in this form has a makefile or script to 
  501.         do everything for you. The  LILO documentation is an example of 
  502.         this. 
  503.  
  504.           Dvips has  several interesting options;  for exemple, ``dvips 
  505.         -r1 file.dvi''  will print it  out backwards.  We deskjet users 
  506.         love this one. 
  507.  
  508.           If all you are given is a file with a .tex ending, try either 
  509.         ``tex file.tex'' or  ``latex file.tex''. One  of these is bound 
  510.         to work. Then you have a dvi. (You may have to run it twice for 
  511.         indexing) 
  512.  
  513.  
  514.         0.2.13 eps 
  515.  
  516.         Eps is  a program  which converts  dvi files  directly into the 
  517.         standard Epson  printer language; thus  it is a  dvi driver for 
  518.         epsons.  I beleive  it supports  MakeTeXPK, the  automatic font 
  519.         rendering system used by many  dvi drivers, and is available as 
  520.         sunsite.unc.edu:/pub/Linux/apps/tex/eps-060.tar.gz      or   in 
  521.         ftp.ctd.comsat.com:/pub/. Note that it is still coming out with 
  522.         new versions fairly often, so there may be a newer version than 
  523.         060. 
  524.  
  525.  
  526.         0.2.14 dvilj 
  527.  
  528.         For  LaserJet  owners,  there is  a  separate  program  which I 
  529.         beleive  is  in the  SLS  that  will take  dvi  and  convert it 
  530.         directly  into  your  printer's language  (PCL).  It  is called 
  531.         dvilj2p or dvilj,  and if not  on tsx or  sunsite, is certainly 
  532.         available on ftp.uu.net. 
  533.  
  534.           (Description by Nils Rennebarth) 
  535.  
  536.           Its a nice driver,  but a little out  of fashion in the sense 
  537.         that configuration (especially of font-paths) font-paths is not 
  538.         very flexible  and that  it doesn't  support virtual  fonts (at 
  539.         least the  version 0.51  not). The  biggest advantage  over the 
  540.         dvips/ghostscript  combo  is that  it  uses  downloadable fonts 
  541.         which: a) reduces data transmission to the printer drastically, 
  542.         which  makes  the printer  usable  even  on a  serial  line. b) 
  543.         reduces  printer-memory-requirements  drastically.  A  standard 
  544.         Laserjet  with  512k  memory  is  able  to  print  almost every 
  545.         TeX-document. 
  546.  
  547.           It has support for double  side printing and most options you 
  548.         expect  a  driver  to  have.  It  compiles  cleanly  and worked 
  549.         flawlessly on our diverse hardware here. 
  550.  
  551.  
  552.         0.2.15 texinfo 
  553.  
  554.         This is  the native  documentation format  of the  GNU project. 
  555.         Emacs can be coerced  into producing an info  file out of this, 
  556.         and TeX  can produce nice  printed documantation  from the same 
  557.         file. It is a bit of a  stretch for both systems, but it works. 
  558.         It  is really  just  TeX source  which  expects the  macro file 
  559.         texinfo.tex  to  be installed  on  your system.  Just  do ``tex 
  560.         <filename>'' twice (for index generation purposes), and you end 
  561.         up with a plain dvi file, to print or preview at your leisure. 
  562.  
  563.           In  emacs,  you  can  also  do  M-x  texinfo-format-buffer to 
  564.         convert the texinfo file into  an info file viewable with emacs 
  565.         M-x info or an info viewer of your choice. 
  566.  
  567.           There are also  separate programs which  read and format info 
  568.         from      a   texinfo    file.    These   are    available   in 
  569.         prep.ai.mit.edu:/pub/gnu/ 
  570.  
  571.  
  572.         0.2.16 hardware and drivers 
  573.  
  574.         There are  two ways the  kernel driver  may be used  to run the 
  575.         parallel ports. One,  the original, is  the polling driver. The 
  576.         other  is the  interrupt  driver. In  principle,  the interrupt 
  577.         driver only deals with  the port when it  gets an interrupt and 
  578.         should therefore  be more  efficient. In  practice, people have 
  579.         found that it depends on  the machine. It probably doesn't make 
  580.         too much difference in most situations. 
  581.  
  582.           For the polling driver, you  may adjust its polling frequency 
  583.         with the  program lptune  without kernel  twiddling. The actual 
  584.         driver is in .../linux/kernel/chr_drv/lp.c. 
  585.  
  586.           To choose  the interrupt driver  rather than  the polled, use 
  587.         the program lptune to set  it. (Lptune is available on sunsite, 
  588.         or from  the printing  mail server.)  Just put  the appropriate 
  589.         line in /etc/rc.local 
  590.  
  591.           Seven is the usual "LPT1:" IRQ,  5 is "LPT2:" for an AT class 
  592.         machine. Note  that if  your printer  is on  lp0, the interrupt 
  593.         driver  will  probably  not work.  The  first  parameter should 
  594.         already contain  the correct i/o  base address.  Many bios boot 
  595.         screens have this information if you need it. 
  596.  
  597.  
  598.         0.2.17 Printer device names 
  599.  
  600.         On an XT bus system  LPT1: becomes /dev/lp0 (major=6, minor=0), 
  601.         on an AT LPT1: becomes  /dev/lp1 (major=6, minor=1). To be more 
  602.         precise: 
  603.  
  604.  
  605.           
  606.           Name Major Minor I/O address
  607.            lp0   6     0       0x3bc
  608.            lp1   6     1       0x378
  609.            lp2   6     2       0x278
  610.           
  611.  
  612.           For a serial printer  use the ttyS? (or  ttys?, if you follow 
  613.         that scheme)  device, not  the cua?  device. The  ttyS? devices 
  614.         have major 4; the cua? devices have major 5. 
  615.  
  616.  
  617.         0.3 LPR 
  618.  
  619.         This section used to  the the lpd-HOWTO then  it became part of 
  620.         the  linux-HOWTO and  now it  is  part of  printing.how-to. Who 
  621.         knows where it will go next? 
  622.  
  623.  
  624.         0.3.1 What lpr and lpd do 
  625.  
  626.         Most un*x  systems use  lpd (or the  System V  variant lp), the 
  627.         line printer  daemon, and friends  to spool print  jobs and run 
  628.         them  through  all  needed  filters.  While  line  printers are 
  629.         certainly on  their way  out, spooling  print jobs  and running 
  630.         them  through filters  is definitely  a convenient  thing. Thus 
  631.         lpr.  (subliminal  note: PLEASE  find  and read  the  lpr, lpd, 
  632.         printcap, lpc, lpq, and lprm man  pages. They are in the source 
  633.         dist of the net-2, if you haven't got them.) 
  634.  
  635.           Lpd and family are available in several places. The new Linux 
  636.         net-2 package contains a  working lpd. I now  use this one with 
  637.         my stock 0.99pl10 kernel after following the directions in Matt 
  638.         Welsh's  net-2  HOWTO to  get  my  NET-2 going  (you  only need 
  639.         loopback). A  binary package which  can be  coaxed into working 
  640.         with the old  net things (pre  0.99pl10 kernel) is  in the SLS. 
  641.         Note a subtle difference between  the two versions: the old one 
  642.         placed  lock  files and  such  in /var/spool,  while  the net-2 
  643.         version requires the directory /var/spool/lpd to exist for it's 
  644.         lock file. 
  645.  
  646.           You will need  to edit /etc/printcap to  configure lpd to use 
  647.         your printer. Setting up lpd  to accept postscript and print it 
  648.         is not very difficult; simply make a shell script fiter (qv). 
  649.  
  650.           Setting up lpr  correctly is definitely  worth the trouble if 
  651.         you are going to do any printing  at all. Of course, if all you 
  652.         ever print is the occasional man page or instruction book, then 
  653.         you can probably get by without it (but even then it's nice). 
  654.  
  655.           Ghostscript 2.6.x  also comes  with a  complicated script and 
  656.         utilities  to  generate printcap  entries  and  manage multiple 
  657.         types of queues for  a printer. I have  not tested these, but I 
  658.         assume they can  be made to  work. If you  are in a large-scale 
  659.         environment with  varied printing needs,  these may  be worth a 
  660.         look. 
  661.  
  662.  
  663.         0.3.2 Where do  the files go and  what should their permissions 
  664.         be? 
  665.  
  666.         There is quite a bit  of variation between the various releases 
  667.         but  I'll  try  where  possible  to  offer  solutions  that are 
  668.         universally   applicable.  Put  /etc/lpd  in  your  /etc/rc  or 
  669.         /etc/rc.local (usually in /etc/rc.local after you start syslogd 
  670.         (if you use syslogd)). 
  671.  
  672.           Set  the group  fields  of the  file  permissons/ownership as 
  673.         follows: 
  674.  
  675.  
  676.           
  677.           -rwxr-s---   1 root     lp          37892 Nov 19 23:32 /etc/lpd
  678.           -rwx--s--x   1 root     lp          21508 Nov 19 23:32 /usr/bin/lpc
  679.           -rws--s--x   1 root     lp          17412 Nov 19 23:32 /usr/bin/lpq
  680.           -rwx--s--x   1 root     lp          17412 Nov 19 23:32 /usr/bin/lpr
  681.           -rwx--s--x   1 root     lp          17412 Nov 19 23:32 /usr/bin/lprm
  682.           -rwxr-xr-x   1 root     lp           2816 May 10 13:37 /usr/bin/lptest
  683.           
  684.           ...and for each of the spool directories listed in the sd fields of
  685.           /etc/printcap... 
  686.           
  687.           /var/spool/lpd:
  688.           total 5
  689.           drwxrwxr-x   2 root     lp           1024 May 18 23:00 .
  690.           drwxr-xr-x  11 root     root         1024 Feb 19 20:56 ..
  691.           -rw-rw-r--   1 root     lp              4 May 18 23:00 .seq
  692.           -rw-rw-r--   1 root     lp             18 May 18 23:00 lock
  693.           -rw-rw-r--   1 root     lp             25 May 18 23:00 status
  694.           
  695.  
  696.           Note these 3  files are created  by lpr and  lpd so if you've 
  697.         never run these they  will be absent and  you should touch them 
  698.         into being. 
  699.  
  700.           In  older  versions  the  group  was  ``daemon''  not ``lp''. 
  701.         There's  also  a named  socket  but lpd  creates/deletes  it as 
  702.         needed. 
  703.  
  704.           Some  of  these  permissions  may  be  overkill  so  don't be 
  705.         surprised if your system  works with different permissions. The 
  706.         fact  that lpq  needs  to be  suid(root)  is inelegant  and may 
  707.         change  in  the  future.  People  tell  me  that  lpr  must  be 
  708.         suid(root) but I've  not seen evidence that  this is really the 
  709.         case as long  as the file  permissions on the  spool queues are 
  710.         right. Still as far as I know lpr is designed to be secure when 
  711.         installed setuid(root). 
  712.  
  713.           Alternative    approach:  just   make   lpc,  lpr   and  lprm 
  714.         setuid(root) then you can almost forget the file permissions on 
  715.         the spool queues! 
  716.  
  717.           You're   free   to  choose  different   directories  for  the 
  718.         executables on your system (notably lpc is usually in /etc even 
  719.         though it has commands that are useful to non-root). 
  720.  
  721.           The  master lpd  lock file  is  fixed at  compile time  to be 
  722.         /var/spool/lpd/lpd.lock  so  you  must  have  a  /var/spool/lpd 
  723.         directory  even if  you  choose not  to  keep your  spool queue 
  724.         there.    In   the   older   binaries   the   lock   file   was 
  725.         /usr/spool/lpd.lock so this was not an issue. 
  726.  
  727.           My advise is keep your  primary spool queue in /usr/spool/lpd 
  728.         and make /var a symlink to usr or keep it in /var/spool/lpd and 
  729.         make  /usr/spool  a  symlink to  ../var/spool.  This  gives the 
  730.         greatest  compatibility with  the  pathnames that  are compiled 
  731.         into the various distributed binaries. 
  732.  
  733.           The main configuration file is /etc/printcap although the old 
  734.         binaries look  for it  in /usr/etc/.  The old  binaries' README 
  735.         says   hosts.equiv  and  hosts.lpd  files  are  looked  for  in 
  736.         /etc/inet but again  the more accepted  convention is to locate 
  737.         them in /etc. 
  738.  
  739.           Since, IMHO,  working out  in which  particular etc directory 
  740.         each file should reside is  tedious, I would advise having only 
  741.         one: 
  742.  
  743.  
  744.           
  745.           mv -i /usr/etc/inet/* /etc/inet/* /usr/etc/* /etc/
  746.           rmdir /usr/etc/inet /etc/inet /usr/etc
  747.           ln -s ../etc /usr/etc
  748.           ln -s . /etc/inet
  749.           
  750.  
  751.           [ But make sure  the files in /usr/etc  and /etc/inet are not 
  752.         already symlinks into /etc or you'll be in deep water. ] 
  753.  
  754.           This makes  your /etc  huge but  I think  it's safe.  All the 
  755.         latest stuff has only /etc paths compiled into it so eventually 
  756.         we can get rid of these links. 
  757.  
  758.  
  759.         0.3.3 What are all these diretories for? 
  760.  
  761.         People  like  to  put  all  things  that  aren't  needed during 
  762.         bootstrap  in /usr  so that  /  is as  small as  possible. They 
  763.         therefore  move unessential  big  files (usually  the binaries) 
  764.         from /etc/ to /usr/etc/. 
  765.  
  766.           Unless you know what you  are doing (or following the example 
  767.         of someone that  does) I'd advise  keeping it all  in /etc with 
  768.         /usr/etc and  /etc/inet being symlinks  back to  /etc. (In fact 
  769.         these links  are probably soon  to be redundant  as most recent 
  770.         binaires now look in /etc/.) 
  771.  
  772.           The Linux/PRO approach  is to have  a real /usr/etc directory 
  773.         containing  all the  non-essential stuff  and make  symlinks to 
  774.         each file therein from its namesake  in /etc. To spread out the 
  775.         configuration  files  for  the  sake  of  tidiness  there  is a 
  776.         directory tree  called /conf  and many  files in  /etc symlinks 
  777.         into this tree. 
  778.  
  779.           Also a few people like  all their internet stuff in /etc/inet 
  780.         but as recent binaries excpect to  find this stuff in /etc they 
  781.         must create links for each file from /etc into /etc/inet. 
  782.  
  783.           To avoid the problem of your  /usr filesystem filling up as a 
  784.         result  of stuff  in spool  queues some  poeple perfer  to keep 
  785.         their  spool  queues and  such  like in  a  separate filesystem 
  786.         called /var.  If you  don't have  a /var  file system  then you 
  787.         should  make /var  a  symlink to  usr. If  you  do have  a /var 
  788.         filesystem  to  may  want  to  make  /usr/spool  a  symlink  to 
  789.         ../var/spool so that any  programs expecting to find /usr/spool 
  790.         will not be dissapointed. 
  791.  
  792.  
  793.         0.3.4 lpd not working 
  794.  
  795.         If ``ps ax'' does not reveal a lpd then you daemon has died (or 
  796.         was never started) - usually a sign that it couldn't create its 
  797.         lockfile (or you tried to  start it before all your filesystems 
  798.         were mounted). 
  799.  
  800.           If  lpr  works  only  for root  then  you've  probably  got a 
  801.         permission problem. 
  802.  
  803.           If you get ``jobs queued, but cannot start daemon'' or ``lpc: 
  804.         connect: No  such file  or directory''  you are  having trouble 
  805.         with the  socket connection to  lpd. "start" in  the context of 
  806.         this error really means "wake".  I don't really understand this 
  807.         but the problem was common in  early days with the old binaries 
  808.         but developments in the TCP/IP code  in the kernel fixed it for 
  809.         most  people. Basically  is stems  from  a network  porblem. If 
  810.         you're  not on  a  network then  try  congifuring youself  as a 
  811.         single node network and the problem should vanish. 
  812.  
  813.  
  814.         0.3.5 Where do I get a printcap for a xxxxx? 
  815.  
  816.         This question is essentially meaningless - see next question. 
  817.  
  818.  
  819.         0.3.6 The semantics of /etc/printcap 
  820.  
  821.         Given    the  similarity   in   appearence  and   name  between 
  822.         /etc/termcap  and  /etc/printcap  one  could  be  forgiven  for 
  823.         assuming that  they contain  analogous infomation.  This is not 
  824.         the case. Whereas termcap  contains informations about terminal 
  825.         *types*    -   (mostly  escape   seqences)   printcap  contains 
  826.         information about *specific* printers  (like the directory that 
  827.         holds the spool queue and the  device name of the printer). The 
  828.         information about a printer model's  escape sequences and so on 
  829.         are held  in the various  filters which are  programs called by 
  830.         lpd  to  drive  the  printer.  /etc/printcap  simply  gives the 
  831.         locations  of  these  filters.  For  details  RTFM(printcap). [ 
  832.         Alternatively the net-HOWTO  has a summary of  some of the more 
  833.         important fields. ] 
  834.  
  835.           One last point you  should always specify ``suppress header'' 
  836.         ``:sh:'' unless  you have  *text* (not  postscript) printer and 
  837.         want banners.  On a  text printer they  are usually  a waste of 
  838.         time and paper. On a  postscript printer they usually stop your 
  839.         printer   working.  (See  the   banners  question  for  further 
  840.         expanation). 
  841.  
  842.  
  843.         0.3.7 The syntax of a /etc/printcap 
  844.  
  845.         Ideally RTFM(termcap)  (yes, I  said *termcap*)  but since most 
  846.         people don't have TFM(termcap) here are the essentials. 
  847.  
  848.           Lines starting # are comments (as you might have guessed). 
  849.  
  850.           For each printer  usable from the lpr  command on your system 
  851.         there  is  one  logical  line in  the  file.  For  the  sake of 
  852.         readability  each  logical  line  may  be  spread  over several 
  853.         physical lines by making the last character on all but the last 
  854.         physical line a backslash. 
  855.  
  856.           Each logical line has the following format: 
  857.  
  858.  
  859.           
  860.           name1|name2|name3:string_capability=string:\
  861.                  :numeric_capability#number:boolean_capability:
  862.           
  863.  
  864.           The  leading spaces  and  colon on  the  second line  are for 
  865.         readability only. 
  866.  
  867.           A   printer  can   have  as  many  names   as  you  like  but 
  868.         conventionally the final name is used as a longhand description 
  869.         of the printer. (Still  people are free to  say `lpr -P "Fred's 
  870.         grotty teletype"' if that's the description you've given.) 
  871.  
  872.           The list  of capabilities  can be as  long as  needed and the 
  873.         order is not  significant. Each ``capability''  is denoted by a 
  874.         two  character code.  (The name  ``capability'' comes  form the 
  875.         file format's termcap  heritage - parameter  or attribute would 
  876.         be a more sensible terms.)  [ Note from Ross Biro: capabilities 
  877.         with 3  character names  don't work  properly which  is why the 
  878.         serial port  stuff in the  old binaries  failed. ] Capabilities 
  879.         having  string  value  and  have  a  =  delimiter  between  the 
  880.         capability  name and  the value  while  those having  a numeric 
  881.         value use  a #  (actually they  can use  either a  # or  an =). 
  882.         Boolean ``capablilties''  are true if  they appear  in the list 
  883.         and false if they do not. 
  884.  
  885.           Special characters in a string value can be expressed using ` 
  886.         \\'-escape sequences as in C;  in addition, `\E' stands for 
  887.         ESC. ` '  is also a kind  of escape character;  ` ' followed by 
  888.         CHAR  stands for  the control-equivalent  of  CHAR. Thus,  ` a' 
  889.         stands for the  character control-a, just  like `\001'. `\' 
  890.         and  ` '  themselves can  be represented  as `\\'  and `\' 
  891.         respectively. `\:' for `:' seems  to work but the source code 
  892.         contains a waring  that it can confuse  the parser and `\072' 
  893.         is a better idea. 
  894.  
  895.  
  896.           
  897.           Example:
  898.           
  899.           lp|bam|BAM's Epson FX-80:lp=/dev/lp1:sd=/usr/spool/lp1:sh:mx#0:\
  900.                   :df=/usr/local/lib/magic-filter/lp.df:\
  901.                   :if=/usr/local/lib/magic-filter/lp.if:
  902.           
  903.  
  904.           Name is lp  (this is the  printer that lpr  uses by default). 
  905.         It's also known as bam or "BAM's Epson FX-80". 
  906.  
  907.           The printer is on /dev/lp1 (aka AT-bus LPT1:). I don't want a 
  908.         burst page. I don't  want a file length  limit. Files queued by 
  909.         `lpr -d'  are passed  through /usr/local/lib/magic-filter/lp.df 
  910.         and           those      queued      by      `lpr'      through 
  911.         /usr/local/lib/magic-filter/lp.lf. 
  912.  
  913.           See also the next section. 
  914.  
  915.  
  916.         0.3.8 An /etc/printcap gotcha 
  917.  
  918.         Two /etc/printcap  files can look  identical and  yet one works 
  919.         and the other doesn't. 
  920.  
  921.           See if ``lpc stat''  reports a printer called  ` :'. The last 
  922.         character  on  a continued  line  must  be a\.  If  there are 
  923.         whitespace characters after the\then  it doesn't register the 
  924.         next line as a continuation. 
  925.  
  926.  
  927.         0.3.9 The minimum /etc/printcap? 
  928.  
  929.         This is a silly question but it is frequently asked. The answer 
  930.         is ``lp:sh''  (that's 6  bytes including  the required linefeed 
  931.         character on the end). To  use this /etc/printcap you must make 
  932.         /dev/lp a symlink  to your printer and  create your spool queue 
  933.         directory  as  /usr/spool/lpd.  (You might  think  that  if you 
  934.         wanted banner pages you could loose the ``:sh'' but the termcap 
  935.         syntax requires at least one capability per entry). 
  936.  
  937.  
  938.         0.3.10 How do I prevent the `staircase effect'? 
  939.  
  940.         Un*x terminates each line  of a file with  a linefeed but not a 
  941.         carriage return so taken literally  a Un*x text file printed on 
  942.         an  ASCII device  will start  each  line below  the end  of the 
  943.         previous line. Some printers can  be set to treat "linefeed" as 
  944.         "carriage return, linefeed", others can't. If yours can then do 
  945.         simply do that. If  the printer cannot be  fixed create a shell 
  946.         script filter that reads: 
  947.  
  948.  
  949.           
  950.           #!/bin/sh
  951.           if [ $1 = -c ]; then
  952.             cat
  953.           else
  954.             sed -e s/$/^M/
  955.           fi
  956.           # the ``echo -ne'' assumes that /bin/sh is realy bash
  957.           echo -ne "f
  958.           
  959.  
  960.           where M is a carriage return character not a followed by a M. 
  961.         To type M in emacs  use the sequence C-q C-m  and in vi use C-v 
  962.         C-m.  Conventionally this  script  is called  /usr/lib/lpf. The 
  963.         test  of $  1 allows  the  isertion of  carriage returns  to be 
  964.         switched off by the `-l' switch on lpr. 
  965.  
  966.           Alternatively your printer  may have an  escape sequence that 
  967.         will  set  the way  it  handles linefeed  characters.  A simple 
  968.         filter that  uses an `echo  -ne' command to  send this sequence 
  969.         may be appropriate. 
  970.  
  971.  
  972.           
  973.           #!/bin/sh
  974.           # Filter for HP printers to treat LF as CRLF  
  975.           # the ``echo -ne'' assumes that /bin/sh is realy bash
  976.           echo -ne "033\&k2G
  977.           cat
  978.           echo -ne "f
  979.           
  980.  
  981.  
  982.         0.3.11 Resetting the printer after each printout 
  983.  
  984.         Either   make   your  filters   do  it   or  define   the  `tr' 
  985.         ``capability'' in /etc/printcap to be your printer's font reset 
  986.         command.  For details  of  the format  of  this string  see the 
  987.         question on  the format  of printcap.  This may  not work  if a 
  988.         printout crashes in the middle  of an escape sequence - putting 
  989.         a lot  of @ on  the front may  help but this  probably won't be 
  990.         enough it  you were  printing raster  graphics when  the filter 
  991.         died. 
  992.  
  993.  
  994.         0.3.12 Preventing formfeed after each printout 
  995.  
  996.         If you don't  have an `if' specified  in /etc/printcap then lpd 
  997.         will automatically put a  formfeed at the end  of each file. If 
  998.         you're using a filter  then it's up to  the filter to decide if 
  999.         it wants to  put a formfeed. To  disable formfeed completely if 
  1000.         you don't  have an  `if' put  :ff=: in  your /etc/printcap. But 
  1001.         please note this suppresses the  formfeed that would usually be 
  1002.         printed  if a  filter dies.  If you  want formfeeds  after text 
  1003.         printouts  but  not on  printouts  printed with  `lpr  -l' then 
  1004.         create the following `if' filter: 
  1005.  
  1006.  
  1007.           
  1008.           #!/bin/sh
  1009.           # the ``echo -ne'' assumes that /bin/sh is realy bash
  1010.           cat
  1011.           if [ "$1" != -c ]; then
  1012.             echo -ne "f
  1013.           fi
  1014.           
  1015.  
  1016.           If you want a formfeed after  `lpr -l' to be optional you can 
  1017.         misuse  the  `-i'  switch to  suppress  the  formfeed  with the 
  1018.         following trick  (after all  `lpr -i  -l' would  usually not be 
  1019.         implemented). 
  1020.  
  1021.  
  1022.           
  1023.           #!/bin/sh
  1024.           cat
  1025.           # use lpr -i -l to print raw without trailing formfeed
  1026.           if [ "$1" != -c -o "$4" = -i0 ]; then 
  1027.             # the ``echo -ne'' assumes that /bin/sh is realy bash
  1028.             echo -ne "f
  1029.           fi
  1030.           
  1031.  
  1032.  
  1033.         0.3.13 Printing to a serial port 
  1034.  
  1035.         The   first  section  applies   to  both  net-2  and  pre-net-2 
  1036.         implementations of lpd; then there is a section applicable only 
  1037.         to the older implementation; the rest applies to net-2 only. 
  1038.  
  1039.           First, there is a kernel patch you need to make. This applies 
  1040.         to  pre-net-2 lpd  as well  (actually, the  use of  this should 
  1041.         probably just  be commented  out of  the lpd  source code). The 
  1042.         change is for  at least patchlevel 10,  but probably all others 
  1043.         as well. 
  1044.  
  1045.           in /usr/src/linux/kernel/chr_drv/tty_ioctl.c, around line 
  1046.         390, you will see: 
  1047.  
  1048.  
  1049.           
  1050.                           case TIOCEXCL:
  1051.                                   return -EINVAL; /* not implemented */
  1052.           
  1053.  
  1054.           Change this to return 0,  recompile the kernel, and you'll be 
  1055.         all set. 
  1056.  
  1057.           The following applies only to the "old" lpd, before net-2. 
  1058.  
  1059.           You cannot set any serial port settings (including baud rate) 
  1060.         in your printcap. Leave them all out and use stty to set up the 
  1061.         port (if necessary) in your rc.local, and you should be all set 
  1062.         (to find the correct stty  settings, start with the default and 
  1063.         twiddle until you can correctly cat a file out the port). 
  1064.  
  1065.           The rest of this applies only to net-2 lpd although it may be 
  1066.         helpful to read. I put more  detail into this because it's what 
  1067.         I use. 
  1068.  
  1069.  
  1070.         0.3.14 Serial settings in printcap 
  1071.  
  1072.         There are two  sets of flags  which you will  need to set, plus 
  1073.         the baud  rate (Note: the  "fc" flag setting  seems to override 
  1074.         the br # capability,  so be sure to  set that correctly as well 
  1075.         as the br # !). 
  1076.  
  1077.           Each of the flags can have  bits set and cleared. Clearing is 
  1078.         done first, so specify the clear flags  (fc # and xc # ) before 
  1079.         the set flags (fs and xs). 
  1080.  
  1081.           Setting the br #  capability is self-explanatory. Example: br 
  1082.         # 9600 
  1083.  
  1084.           It is very easy to translate from 'stty' settings to printcap 
  1085.         flag settings. If you need to, see the man page for stty now. 
  1086.  
  1087.           Use stty  to set up  the printer port  so that you  can cat a 
  1088.         file to it and  have it print correctly.  Here's what "stty -a" 
  1089.         looks like for my printer port: 
  1090.  
  1091.  
  1092.           
  1093.           dina:/usr/users/andy/work/lpd/lpd# stty -a < /dev/ttyS2
  1094.           speed 9600 baud; rows 0; columns 0; line = 0;
  1095.           intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;
  1096.           eol2 = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W;
  1097.           lnext = ^V; min = 1; time = 0;
  1098.           -parenb -parodd cs8 hupcl -cstopb cread -clocal -crtscts
  1099.           -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl ixon -ixoff
  1100.           -iuclc -ixany -imaxbel
  1101.           -opost -olcuc -ocrnl -onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0
  1102.           ff0
  1103.           -isig -icanon -iexten -echo -echoe -echok -echonl -noflsh -xcase -tostop
  1104.           -echoprt -echoctl -echoke
  1105.           
  1106.  
  1107.           The  only  changes  between  this and  the  way  the  port is 
  1108.         initialized  at bootup  are -clocal,  -crtscts, and  ixon. Your 
  1109.         port may well  be different depending on  how your printer does 
  1110.         flow control. 
  1111.  
  1112.           Once you have  your stty settings  right, so that  cat file > 
  1113.         /dev/ttyS2 (in my case) sends the  file to the printer, look at 
  1114.         the file  /usr/src/linux/include/linux/termios.h. This contains 
  1115.         a lot of # defines and a  few structs (You may wish to cat this 
  1116.         file to the printer (you do  have that working, right?) and use 
  1117.         it as scratch paper  -- I did!). Go  to the section that starts 
  1118.         out 
  1119.  
  1120.  
  1121.           
  1122.           /* c_cflag bit meaning */
  1123.           #define CBAUD   0000017
  1124.           
  1125.  
  1126.           This section lists the meaning of the ``fc # '' and ``fs # '' 
  1127.         bits.  You will  notice that  the names  there (after  the baud 
  1128.         rates) match up with one of  the lines of stty output. Didn't I 
  1129.         say this was going to be easy? 
  1130.  
  1131.           Note which of  those settings are  preceded with a  - in your 
  1132.         stty output.  Sum up all  those numbers (they  are octal). This 
  1133.         represents the bits you want to  *clear*, so the result is your 
  1134.         fc # capability.  Of course, remember that  you will be setting 
  1135.         bits directly after you clear, so you can just use fc # 0177777 
  1136.         (I do). 
  1137.  
  1138.           Now do the  same for those settings  (listed in this section) 
  1139.         which do not  have a - before  them in your  stty output. In my 
  1140.         example the important ones  are CS8 (0000060), HUPCL (0002000), 
  1141.         and CREAD (0000200). Also note the  flags for your baud rate -- 
  1142.         mine is 0000015.  Add those all  up, and in  my example you get 
  1143.         0002275. This goes  in your fs  # capability (fs  # 02275 works 
  1144.         fine in my example). 
  1145.  
  1146.           Do the  same with  set &  clear for  the next  section of the 
  1147.         include file, "c_lflag bits". In my case I didn't have to set 
  1148.         anything, so I just use ``xc # 0157777'' and ``xs # 0''. 
  1149.  
  1150.           Once your  printcap is  set up, try  it out.  If things don't 
  1151.         work, see the next section. 
  1152.  
  1153.  
  1154.         0.3.15 cat works to the serial port, but not lpd (1) 
  1155.  
  1156.         Generally getting  lpd up  and running  is explained elsewhere, 
  1157.         but if you are having trouble with serial port settings you can 
  1158.         prevent lpd from trying to  configure your port by treating you 
  1159.         printer as one that does  not present a normal device interface 
  1160.         (qv). 
  1161.  
  1162.  
  1163.      1. Set  your  printer  (in your  printcap)  to  /dev/null1. Create 
  1164.         /dev/null1 using mknod /dev/null1 c 1 3 (because you don't want 
  1165.         /dev/null to be opened exclusively). 
  1166.  
  1167.         remove the baud rate and flags settings from your printcap. 
  1168.  
  1169.  
  1170.      2. Create a script such as this: 
  1171.  
  1172.  
  1173.       
  1174.       #!/bin/sh
  1175.       echo if: $* >> /var/spool/lpd/results
  1176.       # /dev/lp is linked to /dev/ttyS2 which has the printer
  1177.       exec your-old-input-filter $* > /dev/lp
  1178.       
  1179.          ...or if you didn't have an old if installed...
  1180.       
  1181.       #!/bin/sh
  1182.       echo if: $* >> /var/spool/lpd/results
  1183.       cat > /dev/lp
  1184.       # the ``echo -ne'' assumes that /bin/sh is realy bash
  1185.       echo -en "f > /dev/lp
  1186.       
  1187.         Make sure it's  world-executable and world-readable.  I call my 
  1188.         script  /var/spool/lpd/if, to  make things  easy. Try  out your 
  1189.         script (/var/spool/lpd/if < somefile) and see if it prints. 
  1190.  
  1191.  
  1192.      3. Set the  if= capability in  your printcap to  call this script, 
  1193.         e.g. if=/var/spool/lpd/if 
  1194.  
  1195.  
  1196.      4. Use stty to correctly set your port settings. Try to print now. 
  1197.         You should  be able  to tell if  things are  being spooled, and 
  1198.         things *should*  be printed, if  your manual testing  of the if 
  1199.         script works. But this  is a kludge, so the  idea is not to use 
  1200.         the if script. 
  1201.  
  1202.  
  1203.         0.3.16 cat works to the serial port, but not lpd (2) 
  1204.  
  1205.         Assuming the above method using  the "if" filter works and that 
  1206.         you  belive that  you  have specified  what  you think  are the 
  1207.         correct  flags and  baud rate  in printcap;  check ``stty  -a < 
  1208.         /dev/ttyS2''  (or  whatever  your  printer  port  is).  If  the 
  1209.         settings  are  not  correct,  check  your  flags  against  your 
  1210.         printout from termios.h. If the settings are *way* not correct, 
  1211.         you may need to fix lpd  itself. The patch follows, and you can 
  1212.         probably see why  it's needed :-)  It gets applied  in the lpd/ 
  1213.         subdirectory of the lpd source. 
  1214.  
  1215.           (the patch is coming in just a sec) 
  1216.  
  1217.           When I was setting mine up, I followed a sequence like this: 
  1218.  
  1219.  
  1220.           
  1221.           lprm (whatever -- make sure queue is empty and lpd is running)
  1222.           stty (correct settings) < /dev/ttyS2
  1223.           lpr (something small)
  1224.           stty -a < /dev/ttyS2   (often had to ctrl-c out of this one)
  1225.           (twiddle with flags)
  1226.           lprm (whatever -- make sure queue is empty again...)
  1227.           
  1228.  
  1229.           Here's the patch (I think its reversed so apply it with -R): 
  1230.  
  1231.  
  1232.           
  1233.           -------------------------------Cut Here-------------------------------------
  1234.           *** printjob.c  Thu Jul  8 20:56:59 1993
  1235.           --- printjob.c~ Sat Feb 27 09:07:01 1993
  1236.           ***************
  1237.           *** 1271,1277 ****
  1238.                   }
  1239.             #ifdef LINUX
  1240.                   ttybuf.c_cflag &= ~FC;          /* not quite right! */
  1241.           !       ttybuf.c_cflag |= FS;           /* not quite right! */
  1242.             #else
  1243.                   ttybuf.sg_flags &= ~FC;
  1244.                   ttybuf.sg_flags |= FS;
  1245.           --- 1271,1277 ----
  1246.                   }
  1247.             #ifdef LINUX
  1248.                   ttybuf.c_cflag &= ~FC;          /* not quite right! */
  1249.           !       ttybuf.c_cflag |= ~FS;          /* not quite right! */
  1250.             #else
  1251.                   ttybuf.sg_flags &= ~FC;
  1252.                   ttybuf.sg_flags |= FS;
  1253.           -------------------------------Cut Here-------------------------------------
  1254.           
  1255.  
  1256.  
  1257.         0.3.17 Printers that aren't simple character devices 
  1258.  
  1259.         [ Firstly I'll  explain the subject. ]  The most common example 
  1260.         is a printer  that is connected  via a network  in some strange 
  1261.         way.  For  example  consider a  printer  conneccted  to  a host 
  1262.         running some  esoteric OS with  which you  can only communicate 
  1263.         via E-mail. To  use this printer without  going through lpr you 
  1264.         would say something like: 
  1265.  
  1266.         | uuencode tmp | mail printer-request@eosteric 
  1267.  
  1268.         in place of: 
  1269.  
  1270.         > /dev/lp 
  1271.  
  1272.           To use  such a printer  through lpr the  ``lp'' capability of 
  1273.         the print queue  should be directed to  a /dev/null type device 
  1274.         (e.g. ``mknod /dev/null1  c 1 3'') but  not /dev/null itself as 
  1275.         lpd  opens  the  device  exclusively.  Each  filter  must  must 
  1276.         explicitly uuencode and mail its  output. In more complex cases 
  1277.         if you already have an ``if''  or ``of'' filter for a strangely 
  1278.         connected  printer then  other  filters can  pass  their output 
  1279.         to/through this filter to avoid  duplication of effort. In this 
  1280.         case the ``if'' filter should usually be called with the ``-c'' 
  1281.         switch to minimise the further manipulations if performs. 
  1282.  
  1283.  
  1284.         0.3.18 Getting burst/banner pages 
  1285.  
  1286.         For a simple text printer  (in particular not postscript) and a 
  1287.         simple text banner simply take :sh: out of the printcap record. 
  1288.         If you want to prevent the  banner comming out in whatever font 
  1289.         was   last   used  on   the  printer   then  define   the  `tr' 
  1290.         ``capability'' to be your printer's font reset command. 
  1291.  
  1292.           If you want  a fancy customised banner  (or have a postscript 
  1293.         printer)  leave :sh:  in  the printcap  and  make each  of your 
  1294.         filters print  the banner.  All the  information to  put on the 
  1295.         banner  is  included  in  the  filter's  positional parameters. 
  1296.         RTFM(printcap)      for    details.   [    If    you're   using 
  1297.         <B.A.McCauley@bham.ac.uk>'s magic-filter package  then call the 
  1298.         code to print the banners from the config script. ] 
  1299.  
  1300.  
  1301.         0.3.19 Printing text on a PS printer 
  1302.  
  1303.         You need  a filter  based on a  program that  converts ascii to 
  1304.         postscript. The  most well known  of these  is ``enscript'' but 
  1305.         it's  also  the  hardest  to  find.  Others  include  ``a2ps'', 
  1306.         ``nenscript'', and ``mpage'' (for details of these see sections 
  1307.         0.2 - 0.2 ). 
  1308.  
  1309.  
  1310.         0.3.20 Trunation of graphics files 
  1311.  
  1312.         This is usually because  you've got a limit  set on the maximum 
  1313.         size file that can sit in the spool queue. Put `mx # 0' in your 
  1314.         printcap. 
  1315.  
  1316.  
  1317.         0.3.21 Why doesn't `lpr -i' work? 
  1318.  
  1319.         To get lpr -i  to work you need a  filter istalled as `if' that 
  1320.         implements it. The -i switch is  simply passed on by lpd to the 
  1321.         filter. There is such a filter usually called /usr/lib/lpf that 
  1322.         can  be  obtained from  bsd  source archives  in  the directory 
  1323.         bsd-source/lpr/filters. It's  also part  of Fred's  port but he 
  1324.         put it in /usr/bin/. If you whant to use this program but still 
  1325.         want  your filter  to do  some printer  specific initialisation 
  1326.         then write script thus: 
  1327.  
  1328.  
  1329.           
  1330.           #!/bin/sh
  1331.           # My initialisation stuff goes here
  1332.           exec /usr/lib/lpf $*
  1333.           
  1334.  
  1335.  
  1336.         0.3.22 Why doesn't `lpr -p' work? 
  1337.  
  1338.         Because it's  broken. lpd always  thinks that the  printer is 0 
  1339.         characters  wide  regardless of  what  printcap  says. Previous 
  1340.         versions of the lpd-HOWTO contained a patch but it has now been 
  1341.         applied to the latest distribution of the net-2 stuff. 
  1342.  
  1343.           One other thing: lpd calls pr by full pathname so if you keep 
  1344.         pr  somewhere  different  from  /usr/bin/pr  you  will  need  a 
  1345.         symlink. (Where lpd expects to find pr may vary from version to 
  1346.         version). 
  1347.  
  1348.  
  1349.         0.3.23 lprm says `too many users' 
  1350.  
  1351.         You have an anchient libc.so with a broken scandir(). 
  1352.  
  1353.  
  1354.         0.3.24 lpc complains that it hasn't stopped a daemon 
  1355.  
  1356.         One lpd  process runs  all the time  and it  spawns children to 
  1357.         handle each printer  as needed. Sometimes  these children leave 
  1358.         lock files lying about. This is harless. 
  1359.  
  1360.  
  1361.         0.3.25 lpr over a network 
  1362.  
  1363.         To print on the printer listed as foor "foo" in the printcap on 
  1364.         machine "bar.baz.net"  from the machine  "mine.baz.net" you put 
  1365.         an entry like this in your /etc/printcap (on mine.baz.net): 
  1366.  
  1367.         foo:lp=:rm=bar.baz.net:rp=foo:sd=/usr/lpd/spool/foo: 
  1368.  
  1369.         and, of course, create the spool directory /usr/lpd/spool/foo. 
  1370.  
  1371.           There's   no  point  specifying   filters  and  the  like  in 
  1372.         mine.baz.net:/etc/printcap      as    it's    the    ones    in 
  1373.         bar.baz.net:/etc/printcap that will get used. 
  1374.  
  1375.           On the machine bar.baz.foo, you need to put "mine.baz.net" on 
  1376.         a line by itself  in either /etc/hosts.equiv or /etc/hosts.lpd; 
  1377.         note  that  putting  it  in  /etc/hosts.equiv  will  allow  for 
  1378.         unauthenticated logins  as well as  printing. /etc/hosts.lpd is 
  1379.         printing only. 
  1380.  
  1381.  
  1382.         0.3.26 Writing lpd filters 
  1383.  
  1384.         In normal Un*x terminology, filters  are just programs (so they 
  1385.         must have  execute permission)  that read  a stream  from their 
  1386.         standard input and write to their standard output. 
  1387.  
  1388.           lpd filters are filters in the sense that thay read STDIN and 
  1389.         write to STDOUT, but  are unusual in that  they may assume that 
  1390.         their standard input  is a file  and perform lseek() operations 
  1391.         on it. 
  1392.  
  1393.           All lpd  filters have a  common command line  syntax (or more 
  1394.         often simply  ignore command  line parameters).  For details of 
  1395.         the command line parameters RTFM(printcap). 
  1396.  
  1397.           It's easier to debug filters if you test them in an immediate 
  1398.         shell before you install them. (If your filter makes use of its 
  1399.         command line arguments you'll have to specify them too). 
  1400.  
  1401.         my-new-filter <file >/dev/lp1 
  1402.  
  1403.         If you  want to write  a shell script  filter it must  have a # 
  1404.         !/bin/sh header. Here is the generic form of a filter to accept 
  1405.         postscript. 
  1406.  
  1407.  
  1408.         
  1409.         #!/bin/sh
  1410.         /path.../gs -q -dSAFER -dNOPAUSE -r??? -sDevice=?????? -sOutputFile=- -
  1411.         
  1412.         and place its full pathname as  one of the filter (usually `if' 
  1413.         but not  'of'!) parameter in  the printcap for  your printer. I 
  1414.         suggest  putting such  scripts in  a subdirectory  off /usr/lib 
  1415.         (sat /usr/lib/lpd/).  (-dSAFER attempts  to protect  against ps 
  1416.         interpreter  security holes,  -q  and -dNOPAUSE  make  it churn 
  1417.         right along quietly,  and Device is  the appropriate driver for 
  1418.         your printer). 
  1419.  
  1420.           Here is an Epson FX-80 dvi filter using ghostscript: 
  1421.  
  1422.  
  1423.           
  1424.           #!/bin/sh
  1425.           /usr/TeX/bin/dvips -f | \
  1426.           /usr/bin/gs -q -dSAFER -sDEVICE=eps9high -r120x216 \
  1427.                                                   -dNOPAUSE -sOutputFile=- -
  1428.           
  1429.  
  1430.           More tools useful for makeing filters are described elsewhere 
  1431.         in this document. 
  1432.  
  1433.  
  1434.         0.3.27 A filter tests OK but fails when lpd uses it 
  1435.  
  1436.         You may need a # !/bin/sh header. You may also need to set PATH 
  1437.         within  the  script  since  the  daemon's  PATH  may  not  have 
  1438.         everything you need. 
  1439.  
  1440.  
  1441.         0.3.28 `of' filters 
  1442.  
  1443.         Never    use   these.  (Well   strictly   speaking   there  are 
  1444.         circumstances but you're unlikey to meet them). 
  1445.  
  1446.  
  1447.         0.3.29 Getting filters for given printers 
  1448.  
  1449.         From: B.A.McCauley@bham.ac.uk (Brian McCauley) 
  1450.  
  1451.           >From BSD source archives (I think). [ Editors note: I need a 
  1452.         better answer here ] . 
  1453.  
  1454.           If  you already  have  a program  to  print say  DVI  on your 
  1455.         printer  by some  mechanism  then making  it  into a  filter is 
  1456.         usually a  matter of writting  trivial shell script  - see this 
  1457.         HOWTO. If the program you are  using insists on reading a names 
  1458.         file  as input  see the  next question.  Text mode  filters are 
  1459.         trivial too  (see this  HOWTO) unless  you want  lpr to  have a 
  1460.         choice of  fonts in  which case  they are  slightly harder than 
  1461.         trivial.  You  will  probably want  to  insert  and  `echo -ne' 
  1462.         command at the beginning  and end of your  filter to set up the 
  1463.         font etc to your liking. 
  1464.  
  1465.  
  1466.         0.3.30 Filters from programs that won't read STDIN 
  1467.  
  1468.         For example dvilj2p insists  on a named file  as its input (and 
  1469.         what's more expects one with a .dvi suffix) so do this: 
  1470.  
  1471.  
  1472.           
  1473.           #!/bin/sh
  1474.           ln -s /proc/self/fd/0 /tmp/$$.dvi
  1475.           dvilj2p /tmp/$$
  1476.           rm /tmp/$$.dvi
  1477.           
  1478.  
  1479.           Note: If  it wasn't  for the  fact that  dvilj2p adds  a .dvi 
  1480.         suffix you wouldn't  need the temporary  symlink and could just 
  1481.         specify  /proc/self/fd/0 directly.  People  who use  this trick 
  1482.         often  usually keep  permanant  symlinks to  /proc/self/fd/* in 
  1483.         /dev.  If  you  don't  have  procfs  you'll  need  to  create a 
  1484.         temporary file. 
  1485.  
  1486.  
  1487.         0.3.31 Having many filters 
  1488.  
  1489.         Historically the  lpr command was  created to  support a finite 
  1490.         set of possible  file types. You  can, in fact,  use any of the 
  1491.         filters for  any reason.  If you're  never going  to use Benson 
  1492.         Varian raster files you could use  the -v switch for GIF files. 
  1493.         You could even use -d for low res and -v for high res. Remember 
  1494.         that if you create a filter for a file format that takes a long 
  1495.         time to  process then your  printer may sit  idle between print 
  1496.         jobs even when there are things in the queue. 
  1497.  
  1498.           If you are on a network remember that the filter setups go on 
  1499.         the  print  server. One  way  to  avoid running  out  of filter 
  1500.         options is to define  several logical printers in /etc/printcap 
  1501.         that all point to the same  physical one and put each filter in 
  1502.         the ``if''  field of a  different printcap entry.  This has the 
  1503.         advantage that you  can set the  PRINTER enviroment variable to 
  1504.         choose  your filter  rather than  having to  specify it  on the 
  1505.         command line each time. One small problem with this is that you 
  1506.         have no  control over  the order  in which  files from separate 
  1507.         queues are printed. 
  1508.  
  1509.           Another way to avoid running out  of possible types is to use 
  1510.         magic filters. 
  1511.  
  1512.  
  1513.         0.3.32 What are magic filters? 
  1514.  
  1515.         Magic  filters  deduce  their input  files'  types  from `magic 
  1516.         numbers'  (distictive  byte  patterns  at  particular offsets). 
  1517.         Magic  filters are  usually perl  scripts,  shell scripts  or C 
  1518.         programs  that  simply identify  the  file type  then  call the 
  1519.         appropriate     non-magic   filter.    Blatent   plug   :-)   I 
  1520.         <B.A.McCauley@bham.ac.uk>  have  a  generic  magic  filter bash 
  1521.         script that selects the right filter to use based on the output 
  1522.         of  the `file'  command. With  my magic  ``dvi'' filter  (and 3 
  1523.         associated non-magic filters) I can do things like: 
  1524.  
  1525.         lpr -d file1.dvi file2.div.Z file3.ps file4.texinfo.gz 
  1526.  
  1527.         (BTW confguring  lpr to handle  texinfo files is  getting a bit 
  1528.         silly - see previous question). 
  1529.  
  1530.           This                        is             now            at: 
  1531.         tsx-11.mit.edu:pub/linux/sources/usr.bin/magic-filter-0.3.tar.gz 
  1532.         (Although the release number will possibly change in future). 
  1533.  
  1534.           Magic filters  should never specified  as `of'  as the output 
  1535.         filter only gets called  once if a number  of files are printed 
  1536.         without a gap. 
  1537.  
  1538.           IMHO magic  filters as `if'  can also cause  problems as they 
  1539.         may  prevent  you, say,  listing  a PostScript  or  nroff file. 
  1540.         (Other  people  disagree as,  if  you are  making  your printer 
  1541.         available  on  a  network,  it  can  be  a  pain  having people 
  1542.         accidently listing ps files.) The  following is an example of a 
  1543.         magic shell script which should  take either postscript or text 
  1544.         and deal with it: 
  1545.  
  1546.  
  1547.         0.3.33 Magic filter examples 
  1548.  
  1549.         The  following is  an  example of  a  magic shell  script which 
  1550.         should take either postscript or text and deal with it: 
  1551.  
  1552.  
  1553.           
  1554.           #!/bin/sh
  1555.           # This is based on a script I received from Scott Doty and which was
  1556.           # written by Keith Walker.  Keith's script made use of the fact that
  1557.           # lpd passes options to if:
  1558.           #
  1559.           #  <if> -w<width> -l<length> -i<indent> -n <user> -h <host> <accountingfile>
  1560.           # 
  1561.           # to print text out well at any size.  This one does not.  These options
  1562.           # are also handy if you want to do your own snazzy header page, much
  1563.           # like NeWSPrint from Sun does (although running PostScript through
  1564.           # the display server to get it interpreted is a bit much :) 
  1565.           #
  1566.           # This is untested, but bits of it came from working programs, so it 
  1567.           # should work.
  1568.           #
  1569.           # gs will reset the printer anyway, so the this text setup doesn't matter
  1570.           # setup should include the escape code for \n conversion, if applicable
  1571.           #
  1572.           printf "<printer setup for text printing (escape codes, etc)>"
  1573.           
  1574.           read first_line
  1575.           first_two_chars=`expr $first_line : '(..)'`
  1576.           
  1577.           if [ "$first_two_chars" = "%!" ]; then # it's postscript
  1578.           
  1579.                   /usr/bin/gs -dSAFER -dNOPAUSE -q -sDEVICE=??????? -sOutputFile=- -
  1580.           
  1581.           else # it's plain text
  1582.           
  1583.                   echo -n $first_line
  1584.                   cat
  1585.                   printf "\014"
  1586.           
  1587.           fi
  1588.           
  1589.  
  1590.           Note  that for  the paranoid,  shell  scripts run  as someone 
  1591.         other  that  the  user  are  a  security  hole,  but  they  are 
  1592.         illustrative. 
  1593.  
  1594.           An example written in C, which  may be easily adapted to most 
  1595.         installations is available from the printing mail server as lpr 
  1596.         _if.c 
  1597.  
  1598.  
  1599.         0.4 Previewing 
  1600.  
  1601.         These sections  describe various  ways to  preview things under 
  1602.         Linux - that is, how to  view them in a way approximating their 
  1603.         final form without printing them out. 
  1604.  
  1605.  
  1606.         0.4.1 ghostview 
  1607.  
  1608.         Ghostview, a companion  program for gs,  previews postscript on 
  1609.         an X display. It  also lets you select  individual or ranges of 
  1610.         pages from  a postscript document  to print using  lpr. The new 
  1611.         version, 1.5, has fixed a  few glitches which never bothered me 
  1612.         but may  make a difference  to you.  It also calls  gs with the 
  1613.         -dSAFER option  and has  a few  more resource  and command-line 
  1614.         options  relative  to  1.4.1.  The  real  installation  is from 
  1615.         prep.ai.mit.edu:/pub/gnu/ghostview-XXX.tar.gz and builds out of 
  1616.         the box. Ghostview requires gs to  work. The new version of gs, 
  1617.         2.6.x,  will  use  X  display fonts  in  an  effort  to improve 
  1618.         legibility  at  the  low  resolutions  of  a  video  monitor (a 
  1619.         previous   failing   of  this   pair  relative   to  commercial 
  1620.         display-postscript based systems such  as Sun's pageview). This 
  1621.         works  very well  for  me at  least,  at the  expense  of exact 
  1622.         character positioning (x fonts have different widths). In fact, 
  1623.         I thought that  Ghostview looks better  than Sun's pageview the 
  1624.         other  day when  I  looked at  the  same page  in  oth programs 
  1625.         side-by-side. Ghostview/gs also has much more intelligent color 
  1626.         handling than  pageview. You might  wish to let  gs render some 
  1627.         Type 1  fonts you install  instead of using  platform fonts (or 
  1628.         the awful fonts  gs comes with.  To do this  while in ghostview 
  1629.         (or   in  any  situation   involving  the  X11  driver),  place 
  1630.         ``ghostscript.useExternalFonts:   false''  in  your  .Xdefaults 
  1631.         file, and the platform fonts will not be used. 
  1632.  
  1633.           This is  part of a  message posted  to gnu.ghostscript.bug by 
  1634.         Tim Theisen <ghostview@cs.wisc.edu>: 
  1635.  
  1636.           (note  that the  usual Linux  X-server,  XFree, is  simply an 
  1637.         enhanced version of MIT's effort at a i386 X-server (X386), and 
  1638.         does contain  the X11R5 Type  1 rasterizer which  I beleive was 
  1639.         contributed by IBM.) 
  1640.  
  1641.           Ghostscript now  uses the X  Toolkit to pick  up X Resources. 
  1642.         Now  ghostscript  uses the  standard  X rules  that  allow more 
  1643.         specific resources to override  less specific ones giving users 
  1644.         the full  power of  X resources to  control the  X11 driver. It 
  1645.         also allows  system administrators to  establish an application 
  1646.         defaults  file  with resources  specific  to  their ghostscript 
  1647.         installation. 
  1648.  
  1649.           The  customization choices  mentioned  in make.doc  have been 
  1650.         moved  into X  resources  and are  now  configured at  run time 
  1651.         rather than compile  time. Sorry, this  section of make.doc did 
  1652.         not get revised for the 2.6.1 release. 
  1653.  
  1654.           If  useBackingPixmap  is  set,  ghostscript  will  attempt to 
  1655.         allocate   a  backing  pixmap.  If  one  cannot  be  allocated, 
  1656.         ghostscript  will issue  a warning  and  ask for  backing store 
  1657.         instead. (Since there were insufficient resources for a backing 
  1658.         pixmap, the X server may not provide backing store either.) 
  1659.  
  1660.           Color Handling was totally revamped for gs 2.6. 
  1661.  
  1662.           Ghostscript first checks for a suitable standard colormap. If 
  1663.         you have static colormap in your  X server, it would be best to 
  1664.         store   a  standard  colormap   property  on  the  root  window 
  1665.         describing the color  layout. Ghostscript will  then be able to 
  1666.         take  full advantage  of  the device.  If  you have  a standard 
  1667.         colormap  installed,  ghostscript  will  start  slightly faster 
  1668.         since it does not have to allocate colors for a cube or ramp. 
  1669.  
  1670.           If  no  standard  colormap  is  available,  ghostscript  will 
  1671.         allocate  an RGB  cube or  gray ramp.  Ghostscript tries  for a 
  1672.         5x5x5 cube on a color device,  and a 128 gray ramp on grayscale 
  1673.         devices. It will never ask for  more than 1/2 of the colors for 
  1674.         a RGB cube or gray ramp.  It also takes into account the number 
  1675.         of significant bits per pixel. (i.e.  It won't ask for 128 gray 
  1676.         levels if you only have 16 available.) 
  1677.  
  1678.           Ghostscript will attempt to allocate  colors that are off the 
  1679.         color cube/ramp as  the picture is  being rendered. Ghostscript 
  1680.         will  keep track  of 256  dynamic colors.  After all  these are 
  1681.         allocated, ghostscript asks the X server directly. 
  1682.  
  1683.           The foreground  and background  color can  be set explicitly. 
  1684.         This is important for the  visually impaired and when using the 
  1685.         ghostview widget. 
  1686.  
  1687.           Color Resources: 
  1688.  
  1689.  
  1690.       * palette(Palette):   Default  value:  "Color".  Other  allowable 
  1691.         settings:  "Grayscale", "Monochrome".  The palette  resource is 
  1692.         used  to restrict  the palette  used for  display. One  can set 
  1693.         palette to "Grayscale" or "Monochrome"  to see how a file would 
  1694.         be rendered  in grayscale or  monochrome on a  color display. I 
  1695.         use it  to avoid  dithering of gray-  scale figures  on a color 
  1696.         display with 4-bit DACs. 
  1697.  
  1698.  
  1699.       * maxGrayRamp(MaxGrayRamp): Default value: 128. Maximum number of 
  1700.         gray  levels that  ghostscript  will attempt  to  allocate. (It 
  1701.         won't try for more  than this on an  8-bit pseudo color display 
  1702.         even  if you  set  it higher.)  Set this  lower  if you  want a 
  1703.         smaller  ramp  and  would  prefer  ghostscript  to  use dynamic 
  1704.         colors. 
  1705.  
  1706.  
  1707.       * maxRGBCube(MaxRGBCube):  Default  value: 5.  Maximum  number of 
  1708.         colors levels  that ghostscript  will attempt  to allocate. (It 
  1709.         won't try for more  than this on an  8-bit pseudo color display 
  1710.         even  if you  set  it higher.)  Set this  lower  if you  want a 
  1711.         smaller  ramp  and  would  prefer  ghostscript  to  use dynamic 
  1712.         colors. 
  1713.  
  1714.           I  believe  these  values to  be  a  good  compromise between 
  1715.         dynamic allocation and fall back  onto a fairly good color cube 
  1716.         for dithering. 
  1717.  
  1718.           You   can  use  the   foreground  and  background  colors  to 
  1719.         accomplish "reverse  video". However,  if you  have a grayscale 
  1720.         device, it  may be  better to reverse  the gray  ramp using the 
  1721.         following PostScript code fragment: 
  1722.  
  1723.           [  1 exch  sub /exec  load currenttransfer  /exec load  ] cvx 
  1724.         settransfer 
  1725.  
  1726.           The X11  driver now  supports native  X11 fonts.  If you have 
  1727.         installed  the HP  XLFD  font extensions  into  your font  or X 
  1728.         server. Ghostscript will also be  able to use platform fonts at 
  1729.         rotations   of  90  degrees,  with  mirroring,  and  anamorphic 
  1730.         scaling. 
  1731.  
  1732.           The X11 driver does most if its work silently. You can get it 
  1733.         to  report  when  it  is  using  an  X11  font  by  setting the 
  1734.         logExternalFonts boolean in your X resources. 
  1735.  
  1736.           The X11 driver is setup to use the standard fonts distributed 
  1737.         with X11R5. We  purchased the Adobe Type  Manager and the Adobe 
  1738.         Plus  Pack. These  font packages  give  all the  fonts normally 
  1739.         found in the Apple LaserWriter Plus. The X11 driver is setup to 
  1740.         handle these fonts as well. (They  are a superset of the bitmap 
  1741.         fonts distributed with X11.) 
  1742.  
  1743.           You  may set  the  regularFonts, symbolFonts,  or dinbatFonts 
  1744.         resources if you have different fonts available. Each font name 
  1745.         must have 7 dashes  or it will be  ignored. Minimize the use of 
  1746.         wildcards to promote faster matching.  (I once encountered an X 
  1747.         server  that  took  many  seconds  to  do  a  font  lookup when 
  1748.         wildcards were carelessly used.) 
  1749.  
  1750.           There is a different list  of fonts for each common encoding. 
  1751.         Regular  fonts  may be  accessed  in  standard or  ISO  Latin 1 
  1752.         encoding. The  bdf files that  are distributed with  X11 are in 
  1753.         the  ISO  Latin  1 encoding.  This  leaves  out  the ligatures. 
  1754.         Luckily, the  ligatures are present  in the bdf  files, but are 
  1755.         not given an encoding, essentially commenting them out. You can 
  1756.         use   the   fixfont  program   from  the   xproof  distribution 
  1757.         (ftp.cs.wisc.edu:/pub/X/xproof.tar.Z,                        or 
  1758.         ftp.x.org:/contrib/xproof.tar.Z) to reencode  the bdf files and 
  1759.         build  X11  fonts  that  contain  the  ligatures  (i.e standard 
  1760.         encoding). 
  1761.  
  1762.           If  you  have  the  Type1  fonts  mentioned  above,  and  you 
  1763.         installed the Type1  rasterizer into you font  or X server, you 
  1764.         can use  the appended  fonts.scale to  name your  fonts so that 
  1765.         ghostscript can find them. 
  1766.  
  1767.           Font resources: 
  1768.  
  1769.  
  1770.  
  1771.         * useExternalFonts(UseExternalFonts): Default value: true. This 
  1772.           resource controls whether X11 fonts will be used. 
  1773.  
  1774.  
  1775.         * useScalableFonts(UseScalableFonts): Default value: true. This 
  1776.           resource controls whether scalable fonts will be used. If you 
  1777.           have an outline scaler in your X server, you should have this 
  1778.           on. If you  have an X  terminal, you may  get slightly better 
  1779.           performance with this on.  If you have to  use the X11 bitmap 
  1780.           scaler, turn this off. Fonts scaled by the bitmap scaler look 
  1781.           worse than the default ghostscript fonts. 
  1782.  
  1783.  
  1784.         * logExternalFonts(LogExternalFonts):   Default  value:  false. 
  1785.           Controls whether to report when X11 fonts are being used. 
  1786.  
  1787.           The following fonts.scale makes all of the fonts of the Adobe 
  1788.         Type Manager and Adobe Plus  pack available in standard and ISO 
  1789.         Latin  1 encoding.  (We  were able  to  purchase the  above two 
  1790.         packages at an educational discount price of $ 150.) 
  1791.  
  1792.  
  1793.           
  1794.           70
  1795.           agw_____.pfb -Adobe-ITC Avant Garde Gothic-Book-r-normal--0-0-0-0-p-0-iso8859-1
  1796.           agwo____.pfb -Adobe-ITC Avant Garde Gothic-Book-o-normal--0-0-0-0-p-0-iso8859-1
  1797.           agd_____.pfb -Adobe-ITC Avant Garde Gothic-Demi-r-normal--0-0-0-0-p-0-iso8859-1
  1798.           agdo____.pfb -Adobe-ITC Avant Garde Gothic-Demi-o-normal--0-0-0-0-p-0-iso8859-1
  1799.           bkl_____.pfb -Adobe-ITC Bookman-Light-r-normal--0-0-0-0-p-0-iso8859-1
  1800.           bkli____.pfb -Adobe-ITC Bookman-Light-i-normal--0-0-0-0-p-0-iso8859-1
  1801.           bkd_____.pfb -Adobe-ITC Bookman-Demi-r-normal--0-0-0-0-p-0-iso8859-1
  1802.           bkdi____.pfb -Adobe-ITC Bookman-Demi-i-normal--0-0-0-0-p-0-iso8859-1
  1803.           com_____.pfb -Adobe-Courier-Medium-r-normal--0-0-0-0-m-0-iso8859-1
  1804.           coo_____.pfb -Adobe-Courier-Medium-o-normal--0-0-0-0-m-0-iso8859-1
  1805.           cob_____.pfb -Adobe-Courier-Bold-r-normal--0-0-0-0-m-0-iso8859-1
  1806.           cobo____.pfb -Adobe-Courier-Bold-o-normal--0-0-0-0-m-0-iso8859-1
  1807.           hv______.pfb -Adobe-Helvetica-Medium-r-normal--0-0-0-0-p-0-iso8859-1
  1808.           hvo_____.pfb -Adobe-Helvetica-Medium-o-normal--0-0-0-0-p-0-iso8859-1
  1809.           hvb_____.pfb -Adobe-Helvetica-Bold-r-normal--0-0-0-0-p-0-iso8859-1
  1810.           hvbo____.pfb -Adobe-Helvetica-Bold-o-normal--0-0-0-0-p-0-iso8859-1
  1811.           hvn_____.pfb -Adobe-Helvetica-Medium-r-Narrow--0-0-0-0-p-0-iso8859-1
  1812.           hvno____.pfb -Adobe-Helvetica-Medium-o-Narrow--0-0-0-0-p-0-iso8859-1
  1813.           hvnb____.pfb -Adobe-Helvetica-Bold-r-Narrow--0-0-0-0-p-0-iso8859-1
  1814.           hvnbo___.pfb -Adobe-Helvetica-Bold-o-Narrow--0-0-0-0-p-0-iso8859-1
  1815.           ncr_____.pfb -Adobe-New Century Schoolbook-Medium-r-normal--0-0-0-0-p-0-iso8859-1
  1816.           nci_____.pfb -Adobe-New Century Schoolbook-Medium-i-normal--0-0-0-0-p-0-iso8859-1
  1817.           ncb_____.pfb -Adobe-New Century Schoolbook-Bold-r-normal--0-0-0-0-p-0-iso8859-1
  1818.           ncbi____.pfb -Adobe-New Century Schoolbook-Bold-i-normal--0-0-0-0-p-0-iso8859-1
  1819.           por_____.pfb -Adobe-Palatino-Medium-r-normal--0-0-0-0-p-0-iso8859-1
  1820.           poi_____.pfb -Adobe-Palatino-Medium-i-normal--0-0-0-0-p-0-iso8859-1
  1821.           pob_____.pfb -Adobe-Palatino-Bold-r-normal--0-0-0-0-p-0-iso8859-1
  1822.           pobi____.pfb -Adobe-Palatino-Bold-i-normal--0-0-0-0-p-0-iso8859-1
  1823.           sy______.pfb -Adobe-Symbol-Medium-r-normal--0-0-0-0-p-0-iso8859-1
  1824.           tir_____.pfb -Adobe-Times-Medium-r-normal--0-0-0-0-p-0-iso8859-1
  1825.           tii_____.pfb -Adobe-Times-Medium-i-normal--0-0-0-0-p-0-iso8859-1
  1826.           tib_____.pfb -Adobe-Times-Bold-r-normal--0-0-0-0-p-0-iso8859-1
  1827.           tibi____.pfb -Adobe-Times-Bold-i-normal--0-0-0-0-p-0-iso8859-1
  1828.           zcmi____.pfb -Adobe-ITC Zapf Chancery-Medium-i-normal--0-0-0-0-p-0-iso8859-1
  1829.           zd______.pfb -Adobe-ITC Zapf Dingbats-Medium-r-normal--0-0-0-0-p-0-iso8859-1
  1830.           agw_____.pfb -Adobe-ITC Avant Garde Gothic-Book-r-normal--0-0-0-0-p-0-adobe-fontspecific
  1831.           agwo____.pfb -Adobe-ITC Avant Garde Gothic-Book-o-normal--0-0-0-0-p-0-adobe-fontspecific
  1832.           agd_____.pfb -Adobe-ITC Avant Garde Gothic-Demi-r-normal--0-0-0-0-p-0-adobe-fontspecific
  1833.           agdo____.pfb -Adobe-ITC Avant Garde Gothic-Demi-o-normal--0-0-0-0-p-0-adobe-fontspecific
  1834.           bkl_____.pfb -Adobe-ITC Bookman-Light-r-normal--0-0-0-0-p-0-adobe-fontspecific
  1835.           bkli____.pfb -Adobe-ITC Bookman-Light-i-normal--0-0-0-0-p-0-adobe-fontspecific
  1836.           bkd_____.pfb -Adobe-ITC Bookman-Demi-r-normal--0-0-0-0-p-0-adobe-fontspecific
  1837.           bkdi____.pfb -Adobe-ITC Bookman-Demi-i-normal--0-0-0-0-p-0-adobe-fontspecific
  1838.           com_____.pfb -Adobe-Courier-Medium-r-normal--0-0-0-0-m-0-adobe-fontspecific
  1839.           coo_____.pfb -Adobe-Courier-Medium-o-normal--0-0-0-0-m-0-adobe-fontspecific
  1840.           cob_____.pfb -Adobe-Courier-Bold-r-normal--0-0-0-0-m-0-adobe-fontspecific
  1841.           cobo____.pfb -Adobe-Courier-Bold-o-normal--0-0-0-0-m-0-adobe-fontspecific
  1842.           hv______.pfb -Adobe-Helvetica-Medium-r-normal--0-0-0-0-p-0-adobe-fontspecific
  1843.           hvo_____.pfb -Adobe-Helvetica-Medium-o-normal--0-0-0-0-p-0-adobe-fontspecific
  1844.           hvb_____.pfb -Adobe-Helvetica-Bold-r-normal--0-0-0-0-p-0-adobe-fontspecific
  1845.           hvbo____.pfb -Adobe-Helvetica-Bold-o-normal--0-0-0-0-p-0-adobe-fontspecific
  1846.           hvn_____.pfb -Adobe-Helvetica-Medium-r-Narrow--0-0-0-0-p-0-adobe-fontspecific
  1847.           hvno____.pfb -Adobe-Helvetica-Medium-o-Narrow--0-0-0-0-p-0-adobe-fontspecific
  1848.           hvnb____.pfb -Adobe-Helvetica-Bold-r-Narrow--0-0-0-0-p-0-adobe-fontspecific
  1849.           hvnbo___.pfb -Adobe-Helvetica-Bold-o-Narrow--0-0-0-0-p-0-adobe-fontspecific
  1850.           ncr_____.pfb -Adobe-New Century Schoolbook-Medium-r-normal--0-0-0-0-p-0-adobe-fontspecific
  1851.           nci_____.pfb -Adobe-New Century Schoolbook-Medium-i-normal--0-0-0-0-p-0-adobe-fontspecific
  1852.           ncb_____.pfb -Adobe-New Century Schoolbook-Bold-r-normal--0-0-0-0-p-0-adobe-fontspecific
  1853.           ncbi____.pfb -Adobe-New Century Schoolbook-Bold-i-normal--0-0-0-0-p-0-adobe-fontspecific
  1854.           por_____.pfb -Adobe-Palatino-Medium-r-normal--0-0-0-0-p-0-adobe-fontspecific
  1855.           poi_____.pfb -Adobe-Palatino-Medium-i-normal--0-0-0-0-p-0-adobe-fontspecific
  1856.           pob_____.pfb -Adobe-Palatino-Bold-r-normal--0-0-0-0-p-0-adobe-fontspecific
  1857.           pobi____.pfb -Adobe-Palatino-Bold-i-normal--0-0-0-0-p-0-adobe-fontspecific
  1858.           sy______.pfb -Adobe-Symbol-Medium-r-normal--0-0-0-0-p-0-adobe-fontspecific
  1859.           tir_____.pfb -Adobe-Times-Medium-r-normal--0-0-0-0-p-0-adobe-fontspecific
  1860.           tii_____.pfb -Adobe-Times-Medium-i-normal--0-0-0-0-p-0-adobe-fontspecific
  1861.           tib_____.pfb -Adobe-Times-Bold-r-normal--0-0-0-0-p-0-adobe-fontspecific
  1862.           tibi____.pfb -Adobe-Times-Bold-i-normal--0-0-0-0-p-0-adobe-fontspecific
  1863.           zcmi____.pfb -Adobe-ITC Zapf Chancery-Medium-i-normal--0-0-0-0-p-0-adobe-fontspecific
  1864.           zd______.pfb -Adobe-ITC Zapf Dingbats-Medium-r-normal--0-0-0-0-p-0-adobe-fontspecific
  1865.           
  1866.  
  1867.  
  1868.         0.4.2 gspreview 
  1869.  
  1870.         This is  another front-end for  ghostscript. I  have gotten and 
  1871.         built it, and actually preferred the user interface, but it had 
  1872.         a slight glitch which was  probably me doing a careless install 
  1873.         rather than  a program bug.  It didn't seem  as feature-full as 
  1874.         ghostview, though. (Not  that there are  all THAT many features 
  1875.         in      ghostview,    but    it    does    its    job    well). 
  1876.         ftp.x.org:/contrib/GSPreview... 
  1877.  
  1878.  
  1879.         0.4.3 xdvi 
  1880.  
  1881.         A beautifully legible  previewing program for  dvi with a handy 
  1882.         zoom+pan  feature. Will  not interpret  ps specials,  which are 
  1883.         understood only  by dvips (back  to the  compiler, object file, 
  1884.         and now linker analogy :) To view a file, do ``xdvi file.dvi''. 
  1885.         Mine (from  ftp.x.org:/contrib/... )  has the  selfile feature, 
  1886.         where xdvi  puts up  a file  browser... cute  but useless. This 
  1887.         comes with  either TeX  or X  in the  SLS --  I don't remember. 
  1888.         Either way, you've probably got one. 
  1889.  
  1890.  
  1891.         0.4.4 xtex 
  1892.  
  1893.         Xtex is similar  in purpose to  xdvi. I have  tried to build it 
  1894.         under      Linux    and   failed.    It    is    available   as 
  1895.         ftp.x.org:/contrib/xtex-2.18.5.tar.Z 
  1896.  
  1897.  
  1898.         0.4.5 gxditview 
  1899.  
  1900.         Ditview  produces a  preview version  of  troff source  using X 
  1901.         fonts ``groff -TX100 -mandoc  man_page.1'' will run gxditview 
  1902.         to show  you a typeset  version of  the man page.  -TX75 is the 
  1903.         same thing, but tiny. My SLS  didn't have a working one at all. 
  1904.         A good one comes with the source to groff, which you might want 
  1905.         to  get  anyway  for the  additional  drivers  (the  SLS, until 
  1906.         recently,    was   missing   several,   including  postscript). 
  1907.         prep.ai.mit.edu:/pub/gnu/groff-xxxx.tar.z 
  1908.  
  1909.  
  1910.         0.4.6 non-x-previewing 
  1911.  
  1912.         Gs comes with  pc video hardware drivers,  but under un*x these 
  1913.         are not  a good  thing. However,  there are  gs binaries around 
  1914.         which will use the Linux  VGA library (vgalib). The ghostscript 
  1915.         device  for  this  is called  linux,  thus  ``gs -sDEVICE=linux 
  1916.         file.ps''  will  show  you  an  image  of  the  Postscript. The 
  1917.         environment variable GSVGAMODE is important for this. Set it to 
  1918.         the nuber  of the  video mode  you want,  taken from  the vga.h 
  1919.         which comes with vgalib. 
  1920.  
  1921.           At  one point  the SLS  binaries had  this driver,  then they 
  1922.         didn't, and now  they do again  (I saw an  announcement to this 
  1923.         effect Aug 14).  (``gs -help'' will  list the available drivers 
  1924.         in your binary.) 
  1925.  
  1926.           If you need this  driver, a patch to  put in Linux svgalib is 
  1927.         available as ws105.zfn.uni-bremen.de:/pub/gs261-linuxdriver.sh. 
  1928.         The plain vgalib driver is available on Sunsite. 
  1929.  
  1930.           Texmgr is a program which will preview dvi under MGR. I don't 
  1931.         beleive  that it  currently works  under Linux  MGR, but  if it 
  1932.         does,  MGR uses  sufficiently less  memory  and disk  that this 
  1933.         might be an attractive option for some. 
  1934.  
  1935.           dvgt is a program which  will preview dvi with Linux svgalib, 
  1936.         or on one of several  types of graphics terminals including vt, 
  1937.         tek, or a PC with MS-Kermit. It is available on sunsite. 
  1938.  
  1939.  
  1940.         0.5 Ascii translation 
  1941.  
  1942.         These  sections describe  various  programs which  can generate 
  1943.         plain ascii from some file formats. 
  1944.  
  1945.  
  1946.         0.5.1 from TeX 
  1947.  
  1948.         Lametex will generate ascii from tex source. It is available as 
  1949.         sunsite.unc.edu:/pub/Linux/apps/tex/lametex.tar.z 
  1950.  
  1951.  
  1952.         0.5.2 from dvi 
  1953.  
  1954.         Dvi2tty is the  name of a  program which will  process dvi into 
  1955.         text. Aparently,  it will  also make  an effort  at reproducing 
  1956.         graphics as well. 
  1957.  
  1958.  
  1959.         0.5.3 from ps 
  1960.  
  1961.         Ghostscript 2.6.1 comes with a script file which will use gs to 
  1962.         extract just the text from a  ps file, called ps2ascii. See the 
  1963.         gs  information  above  for  where  it  can  be  found. Further 
  1964.         documentation is  in the  ghostscript 2.6.1  distribution files 
  1965.         `gs_2asc.ps' and `use.doc' 
  1966.  
  1967.  
  1968.         0.5.4 from troff 
  1969.  
  1970.         groff -Tascii or -Tlatin1..... 
  1971.  
  1972.  
  1973.         0.5.5 from ascii/latin1 
  1974.  
  1975.         The GNU program recode handles conversion between various forms 
  1976.         of straight text encoding, ie from Latin-1 to ASCII. This would 
  1977.         be available on prep.ai.mit.edu. 
  1978.  
  1979.  
  1980.